How to Convert byte array to hexString in java?

hiii :

I have byte array that consist of hex values like CA ,FA,21,33

But I want to list them in JList as a single element CAFA2133. In order to list them in JList I think I need to convert it to string. So any recommendation?

Brian Agnew :

You need to look at String.format() and the Formatter specifications.

e.g.

String.format("%02x", byteValue);

Iterate through the array and append each String.format() result to a StringBuilder

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to convert a Scala Array[Byte] to Java byte[]?

How to convert a String array to a Byte array? (java)

How do I convert a Java byte array into a Scala byte array?

How to convert a byte array to a hex string in Java?

How to convert array byte to string in java

how to convert image to byte array in java?

How to convert byte array to Mat object in Java

How to convert a Java String to an ASCII byte array?

How to convert array of byte to String in Java?

How BigInteger convert a byte array to number in Java?

How to convert signed byte array to ascii in Java

In Java, how can I convert an InputStream into a byte array (byte[])?

How to convert a hexstring to shellcode format?

Java DataInputStream convert to byte array?

Convert ByteBuffer to byte array java

Convert Java string to byte array

Convert InputStream to byte array in Java

Convert integer into byte array (Java)

Convert a StringBuffer to a byte Array in Java

Convert the byte array to java types

How to convert specific byte in a byte array to integer

How to convert a array of bits to a byte, (not to byte string)?

How to convert a string to byte array in bcd format in java?

How to convert uint8 byte array to string in Java

How to convert java BigDecimal to normal byte array (not 2's complement)

How to convert a byte array to its numeric value (Java)?

How to convert an integer value into 'n' digit ascii byte array in java

How to convert bigint to byte array in perl similar as java

How to convert efficiently binary string to binary byte array in Java?