public static String byteArrayToHexString(@Nullable final byte[] array) {
        final byte[] safeArray = array == null ? new byte[0] : array;
        final StringBuilder sb = new StringBuilder();
        boolean firstEntry = true;
        sb.append('[');

        for (final byte b : safeArray) {
            if (!firstEntry) {
                sb.append(", ");
            }
            sb.append(HEXES.charAt((b & 0xF0) >> 4));
            sb.append(HEXES.charAt((b & 0x0F)));
            firstEntry = false;
        }

        sb.append(']');
        return sb.toString();
    }
Gets a pretty representation of a Byte Array as a HEX String.
<p>
Sample output: [01, 30, FF, AA]

@param array the array
@return the string
library/src/main/java/dev/alt236/bluetoothlelib/util/ByteUtils.java