All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.peersafe.base.encodings.common.B16 Maven / Gradle / Ivy

The newest version!
package com.peersafe.base.encodings.common;


import static org.bouncycastle.util.encoders.Hex.toHexString;

public class B16 {

    public static String toStringTrimmed(byte[] bytes) {
        int offset = 0;
        if (bytes[0] == 0) {
            offset = 1;
        }
        return toHexString(bytes, offset, bytes.length - offset).toUpperCase();
    }
    @Deprecated
    public static String toString(byte[] bytes) {
        return encode(bytes);
    }

    public static String encode(byte[] bytes) {
        return toHexString(bytes).toUpperCase();
    }

    public static byte[] decode(String hex) {
        return org.bouncycastle.util.encoders.Hex.decode(hex);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy