Java Utililty Methods Array to Hex String

List of utility methods to do Array to Hex String

  1. HOME
  2. Java
  3. A
  4. Array to Hex String

Description

The list of methods to do Array to Hex String are organized into topic(s).

Method

String arrayToHexString(byte[] array)
Helper method to convert a byte[] array (such as a MsgId) to a hex string
return arrayToHexString(array, 0, array.length);
String arraytohexstring(byte[] bytes)
arraytohexstring
StringBuilder string = new StringBuilder();
for (byte b : bytes) {
 String hexString = Integer.toHexString(0x00FF & b);
 string.append(hexString.length() == 1 ? "0" + hexString : hexString);
return string.toString();
String arrayToHexString(final byte[] byteArray)
Convert a byte array into hex sequence like [#01 #02 #03]
final StringBuilder result = new StringBuilder();
result.append('[');
boolean space = false;
for (final byte b : byteArray) {
 if (space) {
 result.append(' ');
 } else {
 space = true;
...

AltStyle によって変換されたページ (->オリジナル) /