class Util {

  public static String toDebugString(ByteString bytes) {
    int size = bytes.size();
    StringBuilder result = new StringBuilder(2 * size);
    for (int i = 0; i < size; i++) {
      int value = bytes.byteAt(i) & 0xFF;
      result.append(Character.forDigit(value >>> 4, 16));
      result.append(Character.forDigit(value & 0xF, 16));
    }
    return result.toString();
  }

}