Java Utililty Methods Byte Array Convert To

List of utility methods to do Byte Array Convert To

Description

The list of methods to do Byte Array Convert To are organized into topic(s).

Method

StringbytesToStringMac(byte[] mac)
bytes To String Mac
StringBuilder sb = new StringBuilder(18);
for (byte b : mac) {
    if (sb.length() > 0) {
        sb.append(':');
    sb.append(String.format("%02x", b));
return sb.toString();
...
StringbytesToStringUTFCustom(byte[] bytes)
Use during externalization methods....FAST as it avoids charset encoding From http://www.javacodegeeks.com/2010/11/java-best-practices-char-to-byte-and.html
char[] buffer = new char[bytes.length >> 1];
for (int i = 0; i < buffer.length; i++) {
    int bpos = i << 1;
    char c = (char) (((bytes[bpos] & 0x00FF) << 8) + (bytes[bpos + 1] & 0x00FF));
    buffer[i] = c;
return new String(buffer);
longbytesToSVar64(final byte[] buffer, final int offset)
bytes To S Var
return zigzagToLong(bytesToVar64(buffer, offset));
intbytesToTagBE(byte[] bytes, int off)
bytes To Tag BE
return bytesToIntBE(bytes, off);
StringbytesToText(byte[] bytes)
Convert bytes to text
StringBuffer sb = new StringBuffer(bytes.length * 2);
for (int i = 0; i < bytes.length; i++) {
    int num = bytes[i];
    if (num < 0)
        num = 127 + (num * -1); 
    String hex = Integer.toHexString(num);
    if (hex.length() == 1) {
        hex = "0" + hex; 
...
shortBytesToUInt16(byte[] pb)
Bytes To U Int
assert (pb != null) && (pb.length == 2);
if (pb == null)
    throw new IllegalArgumentException("pb");
if (pb.length != 2)
    throw new IllegalArgumentException();
return (short) (bint(pb[0]) | (bint(pb[1]) << 8));
intbytesToVar32(final byte[] buffer, final int offset)
bytes To Var
if (buffer == null) {
    throw new NullPointerException("buffer must not be null");
checkBound(buffer.length, offset);
fastpath: {
    int pos = offset;
    final int bufferSize = buffer.length;
    if (bufferSize == pos) {
...