Android Byte Array to Hex Convert toHex(byte[] b)

Here you can find the source of toHex(byte[] b)

Description

to Hex

Declaration

public static String toHex(byte[] b) 

Method Source Code

//package com.java2s;
import java.util.Formatter;
import java.util.Locale;

public class Main {
    public static String toHex(byte[] b) {
        StringBuilder sb = new StringBuilder();
        Formatter fmt = new Formatter(sb, Locale.US);
        for (int i = 0; i < b.length; ++i) {
            fmt.format("%02X", b[i]);
        }// ww  w  . j av  a 2 s. c o m
        return fmt.toString();
    }
}

Related

  1. toHexString(byte[] b)
  2. toHexString(byte[] buf, int offset, int length)
  3. toHexString(byte[] data)
  4. getHexString(byte[] b)
  5. getHexString(byte[] b, String splitString)
  6. bytesToHexString(byte[] bytes)
  7. hexToHexString(byte[] b)
  8. toHexString(byte[] b)
  9. bytesToHexString(byte[] src)