public String convertBinaryToHexString(byte[] bytes){
  StringBuilder builder=new StringBuilder(bytes.length * 2);
  for (  byte b : bytes) {
    int highBitsInt=(b >> 4) & 0xF;
    int lowBitsInt=b & 0xF;
    builder.append(HEX_CHARS[highBitsInt]);
    builder.append(HEX_CHARS[lowBitsInt]);
  }
  return builder.toString();
}

public String convertBinaryToHexString ( byte [ ] bytes ) { StringBuilder builder = new StringBuilder ( bytes . length * 2 ) ; for ( byte b : bytes ) { int highBitsInt = ( b > > 4 ) & 0xF ; int lowBitsInt = b & 0xF ; builder . append ( HEX_CHARS [ highBitsInt ] ) ; builder . append ( HEX_CHARS [ lowBitsInt ] ) ; } return builder . toString ( ) ; }
convert the provided binary into a hex - string representation where each character represents 4 bits of the provided binary , i . e each byte requires two characters . < p > the returned hex characters are upper - case .
