+/*
+ * Svjatoslav Commons - shared library of common functionality. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
+ */
package eu.svjatoslav.commons.data;
public class HexConverter {
- static final String hexCodes = "0123456789ABCDEF";
+ static final String hexCharacters = "0123456789ABCDEF";
- public static String byteArrayToHex(final byte[] raw) {
+ public static String byteArrayToHex(final byte[] bytes) {
- if (raw == null)
- return null;
+ if (bytes == null)
+ return null;
- final StringBuilder result = new StringBuilder(2 * raw.length);
+ final StringBuilder result = new StringBuilder(2 * bytes.length);
- for (final byte b : raw)
- result.append(hexCodes.charAt((b & 0xF0) >> 4)).append(
- hexCodes.charAt((b & 0x0F)));
+ for (final byte b : bytes)
+ result.append(hexCharacters.charAt((b & 0xF0) >> 4)).append(
+ hexCharacters.charAt((b & 0x0F)));
- return result.toString();
- }
+ return result.toString();
+ }
}