Linked Questions

0 votes
2 answers
8k views

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. ...
Nicholas Miller's user avatar
0 votes
2 answers
722 views

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 ...
Singee's user avatar
  • 523
0 votes
1 answer
403 views

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 ...
Andrey's user avatar
  • 479
0 votes
0 answers
139 views

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 (...
Siti Aishah Ismail's user avatar
151 votes
11 answers
298k views

what's a fast way to convert an Integer into a Byte Array? e.g. 0xAABBCCDD => {AA, BB, CC, DD}
Buttercup's user avatar
  • 2,037
85 votes
4 answers
153k views

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) ...
Petey B's user avatar
  • 11.6k
48 votes
10 answers
156k views

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 ...
nunos's user avatar
  • 21.6k
4 votes
4 answers
2k views

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 ...
user3487667's user avatar
1 vote
1 answer
16k views

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]; ...
Rachita Nanda's user avatar
0 votes
4 answers
2k views

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 ...
the_prole's user avatar
  • 9,043
0 votes
2 answers
3k views

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, (...
resti's user avatar
  • 1
0 votes
1 answer
2k views

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("...
user3965683's user avatar
2 votes
2 answers
713 views

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....
jim's user avatar
  • 9,168
-1 votes
2 answers
422 views

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. ...
Jack's user avatar
  • 17
1 vote
1 answer
649 views

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....
user3749837's user avatar

15 30 50 per page