private static String byte2hex ( byte [ ] bytes ) { char [ ] hexChars = { ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' } ; StringBuffer sb = new StringBuffer ( ) ; for ( byte b : bytes ) { sb . append ( hexChars [ b >> 4 & 0xf ] ) ; sb . append ( hexChars [ b & 0xf ] ) ; } return new String ( sb ) ; }
Converts a hash into its hexadecimal string representation .