Here you can find the source of toHex(byte in)
private static byte toHex(byte in)
//package com.java2s; public class Main { private static byte toHex(byte in) { if (in >= '0' && in <= '9') { return (byte) (in - '0'); } else if (in >= 'A' && in <= 'F') { return (byte) (in - 'A'); } else if (in >= 'a' && in <= 'f') { return (byte) (in - 'a'); }/*from w w w. j ava 2 s .c o m*/ return in; } }