Linked Questions

1 vote
1 answer
2k views

i m new to java. i want to convert a byte array of decimal value to hexadecimal string. my input byte array is [0, 0, 0, 0, 0, 0, 1, -28]. i m getting 00000000000001e4 instead of 0000001e4. plz help ...
Sachin K S's user avatar
1 vote
1 answer
1k views

I have a MAC address represented as a byte[] in Java and want it as a hexadecimal string, as they are usually represented. How can I do this with as easy as possible? The byte array has length 6.
Darth_Peter's user avatar
831 votes
34 answers
1.1m views

I have a byte array filled with hex numbers and printing it the easy way is pretty pointless because there are many unprintable elements. What I need is the exact hexcode in the form of: 3a5f771c
Andre's user avatar
  • 9,200
462 votes
25 answers
653k views

I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array. I couldn't have phrased it better than the person that posted the same question here. But ...
rafraf's user avatar
  • 5,006
183 votes
13 answers
326k views

I'm trying to make a simple String to SHA1 converter in Java and this is what I've got... public static String toSHA1(byte[] convertme) { MessageDigest md = null; try { md = ...
Brian's user avatar
  • 8,095
16 votes
5 answers
41k views

i was wondering if the solution for this documented here is still the solution or is there any other way getting an int from 4 bytes? thank you. EDIT: im getting the byte[] from sockets .read EDIT: ...
iTEgg's user avatar
  • 8,368
16 votes
1 answer
24k views

I migrating a maven project in Java 8 to a Java 9 project without any build tool in Eclipse OxyGen 1a. So my module-info.java looks like this: But java.xml.bind is not accessible, although its in my ...
user3133542's user avatar
  • 1,715
5 votes
1 answer
8k views

I am trying to compare the SHA-256 hash values of the same file with Python and Java. However, in some instances, the Python hash value has leading zeros, whereas the Java version does not. For ...
Espresso's user avatar
  • 930
4 votes
2 answers
7k views

I'm porting some Java code to PHP code. In Java I have a hash SHA256 code as below: public static String hashSHA256(String input) throws NoSuchAlgorithmException { MessageDigest mDigest = ...
user2663561's user avatar
3 votes
1 answer
10k views

I'm trying to insert a Java byte[] into an H2 database table and then retrieve it again, but i am not achieving success. According to this page, the BINARY data type maps directly to a byte[]. So my ...
wmdvanzyl's user avatar
  • 362
3 votes
3 answers
2k views

How store values greater than 127 in byte datatype in java. int b = 160; System.out.println((byte)b); It prints -96. Note : I want to write bytes on a BLE device. So can not convert it to short ...
Amit Shinde's user avatar
-5 votes
1 answer
12k views

I want to write byte array to txt file. Firstly I want to see that data in eclipse console and I see that data are true. But when I want to write this data into txt file the problem is manifest itself....
bzkrtmurat's user avatar
3 votes
1 answer
5k views

I sent a GET message with socket. And I received response message as string. But I want to receive as hexadecimal. But I didn't accomplish. This is my code block as string. Can you help me ? ...
Fatih ELMA's user avatar
2 votes
1 answer
5k views

I'm looking at parsing information from a temp/humidity sensor that was provided with the following instructions; There are 6 bytes. Temperature positive/negative: 0 means positive (+) and 1 ...
Mannie's user avatar
  • 1,684
2 votes
1 answer
5k views

I am attempting to write a very simple merkle-tree implementation in Java. I am using the values of the txids in block 170 on the bitcoin blockchain for reference, so I can see what the correct ...
apt-getschwifty's user avatar

15 30 50 per page