com.peersafe.base.encodings.common.B16 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chainsql Show documentation
Show all versions of chainsql Show documentation
ChainSQL JAVA API is an api for chainsql server
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);
}
}