Java Byte Array to Base16 byteToBase16(byte[] bytes)

Here you can find the source of byteToBase16(byte[] bytes)

Description

byte To Base

License

Open Source License

Declaration

public static final String byteToBase16(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String byteToBase16(byte[] bytes) {
        if (bytes == null) {
            throw new IllegalArgumentException("The parameter should not be null!");
        }//from w w w . j  av a  2s .  c o  m
        StringBuilder sb = new StringBuilder(bytes.length * 2);
        for (byte b : bytes) {
            sb.append(Integer.toHexString((b & 0xF0) >> 4));
            sb.append(Integer.toHexString(b & 0x0F));
        }
        return sb.toString();
    }
}

Related

  1. bytesToBase16(byte[] bytes)