code: public static void binToHex(byte[] bin, int start, int length, StringBuffer hex) {
  
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "binToHex", new Object[]{bin, Integer.valueOf(start), Integer.valueOf(length), hex});
  
      /* Constant for binary to Hex conversion                                  */
      final char BIN2HEX[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
  
      int binByte;
  
      for (int i=start; i<start+length; i++)
      {
        binByte = bin[i];
  
        /* SibTreat the byte as unsigned */
        if (binByte < 0) binByte += 256;
  
        /* Convert and append each digit */
        hex.append(BIN2HEX[binByte/16]);
        hex.append(BIN2HEX[binByte%16]);
      }
  
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "binToHex", hex);
  
    }
docs: Converts a binary value held in a byte array into a hex string, in the
  given StringBuffer, using exactly two characters per byte of input.
  
  @param bin    The byte array containing the binary value.
  @param start  The offset into the byte array for conversion to start..
  @param length The number of bytes to convert.
  @param hex    The StringBuffer to contain the hex string.