Linked Questions
22 questions linked to/from Java integer to byte array
0
votes
2
answers
8k
views
How to convert an Integer into a formatted 4-Byte Hexidecimal (with leading 0's) [duplicate]
Possible Duplicate:
Java integer to byte array
Here's another question still related to the original below:
If I have a hex number that takes up 4 characters (2-bytes) saved as an integer.
...
0
votes
2
answers
722
views
How to split int/float variable - Java/Android [duplicate]
I've a newbie question about Java type manipulation. I want to split a float variable and an int variable into bytes.
My question is, how I can split this variables?
Something like this:
int or ...
0
votes
1
answer
403
views
How to convert integers from 0 to 2000 to a byte array of length 2 and vice versa? Java [duplicate]
Well the questions is pretty much as the title. In my application I am sending array with 2 bytes using UDP packets. I want to know if there is a way to convert the integers from 0 to 2000 into bytes ...
0
votes
0
answers
139
views
Java: How to split the integer(hex value) into byte array [duplicate]
I have an int in a hex value, the problem now how I can get each byte of it.
int hex = 0xDF60;
What I want is:
int byte1 = 0xDF;
int byte2 = 0x60;
Already refer the answer from this question (...
151
votes
11
answers
298k
views
Convert integer into byte array (Java)
what's a fast way to convert an Integer into a Byte Array?
e.g. 0xAABBCCDD => {AA, BB, CC, DD}
85
votes
4
answers
153k
views
Java - Convert int to Byte Array of 4 Bytes? [duplicate]
Possible Duplicate:
Convert integer into byte array (Java)
I need to store the length of a buffer, in a byte array 4 bytes large.
Pseudo code:
private byte[] convertLengthToByte(byte[] myBuffer)
...
48
votes
10
answers
156k
views
Byte Array and Int conversion in Java
I am having some difficulty with these two functions: byteArrayToInt and intToByteArray.
The problem is that if I use one to get to another and that result to get to the former, the results are ...
4
votes
4
answers
2k
views
What is the most efficient way to convert array of int to array of byte and vice versa?
I am looking for the most efficient way to convert array of int to array of byte and vice versa.
I want to write a huge number of int array and String to files so I can read them efficiently. I think ...
1
vote
1
answer
16k
views
Convert int to hex byte value
I want to read block wise data of NFC tag. For which the command is a byte array and it needs block number.
public static byte[] readSingleBlockCmd(int blockNo) {
byte[] cmd = new byte[3];
...
0
votes
4
answers
2k
views
How to extract and display each of the four bytes of an integer individually as 8-bit values
edit: This question is not a duplicate. The whole point is to solve the question using masks and bit shifts.
I have a terrible programming teacher that introduces concepts without explaining them or ...
0
votes
2
answers
3k
views
Getting the two bytes by adding the 16 bit unsigned of the byte array as checksum
I have this array of bytes that I want to calculate to get a 2 byte checksum.
byte[] b = {(byte) 0x80, (byte) 0x00, (byte) 0x81, (byte) 0x01, (byte) 0x80, (byte) 0x01,(byte) 0x00, (byte) 0x00, (...
0
votes
1
answer
2k
views
Convert int to bytes
I had a calendar widget and passed the values to another activity through bundle. How can I, after getting values from bundle, convert "year","month","day" into bytes?
int year = extras.getInt("...
2
votes
2
answers
713
views
Java integer to byte array Blackberry J2ME
I've found this solution but it seems to be for Java SE. I can't find an alternative to the System.out.format() function. Also, I have changed the ByteBuffer.allocate() function to ByteBuffer....
-1
votes
2
answers
422
views
RC4 Encryption/Decryption for integers Java
In short, I have a integer value about 10 digits long. I would like to encrypt it using rc4 algorithm in Java. I went online and search, but I could only find encryption for string values/plaintext. ...
1
vote
1
answer
649
views
QR code compilation error
I am trying to make a q code to hold a number to transfer it to others so i made a test
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io....