Here you can find the source of toHexStringUpperCase(byte[] b)
public static String toHexStringUpperCase(byte[] b)
//package com.java2s; // Licensed to the Apache Software Foundation (ASF) under one public class Main { private static final char[] hexCharsUpperCase = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String toHexStringUpperCase(byte[] b) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { sb.append(hexCharsUpperCase[(int) (((int) b[i] >> 4) & 0x0f)]); sb.append(hexCharsUpperCase[(int) (((int) b[i]) & 0x0f)]); }//from w w w. ja va 2s. co m return sb.toString(); } }