code: private static String convertToHex(byte[] data) {
  
          final StringBuffer buffer = new StringBuffer();
  
          for (int i = 0; i < data.length; i++) {
  
              int halfByte = (data[i] >>> 4) & 0x0F;
              int twoHalves = 0;
  
              do {
  
                  if ((0 <= halfByte) && (halfByte <= 9)) {
                      buffer.append((char) ('0' + halfByte));
                  } else {
                      buffer.append((char) ('a' + (halfByte - 10)));
                  }
  
                  halfByte = data[i] & 0x0F;
  
              } while(twoHalves++ < 1);
          }
  
          return buffer.toString();
      }
docs: Converts an array of bytes to its hexadecimal equivalent
  
  @param data
  @return String Hexadecimal equivalent of the byte array