code: protected static long fromHex(String hex) {
          long value = 0;
          for (int i = 0; i < hex.length(); i++)
              value = (value << 4) | digit(hex.charAt(i), 16);
  
          return value;
      }
  
      protected static String encodeULong(long value) {
          return String.format("%016x", value);
      }
  
      protected static String encodeUInt(int value) {
          return String.format("%08x", value);
      }
  
      protected static int normalizeFloat(float value) {
          int intBits = floatToIntBits(value);
          if (intBits < 0)
              return ~intBits;
          else
              return intBits ^ Integer.MIN_VALUE;
      }
  
      protected static float denormalizeFloat(int value) {
          if (value > 0)
              return intBitsToFloat(~value);
          else
              return intBitsToFloat(value ^ Integer.MIN_VALUE);
      }
  
      protected static long normalizeDouble(double value) {
          long longBits = doubleToRawLongBits(value);
          if (longBits < 0)
              return ~longBits;
          else
              return longBits ^ Long.MIN_VALUE;
      }
  
      protected static double denormalizeDouble(long value) {
          if (value > 0)
              return longBitsToDouble(~value);
          else
              return longBitsToDouble(value ^ Long.MIN_VALUE);
      }
  
      public static byte[] reverse(byte[] bytes) {
          byte[] result = new byte[bytes.length];
  
          for (int i = 0; i < bytes.length; i++)
              result[i] = (byte) (0xff - (0xff & bytes[i]));
  
          return result;
      }
  }
docs: Returns the raw bit representation of a string of hex digits.
  <p/>
  Helper function simply because Long.parseLong(hex,16) does not handle negative numbers that were
  converted to hex.