/**
* Conversion routines for handling hexadecimal numbers.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class Hex {
/**
* Converts the given byte array to a hexadecimal string.
- *
+ *
* @param dataBytes
* The bytes to convert
* @return A string of hexadecimal numbers
*/
public static String toHex(byte[] dataBytes) {
StringBuilder hexString = new StringBuilder(dataBytes.length * 2);
- for (byte dataByte: dataBytes) {
+ for (byte dataByte : dataBytes) {
String hexByte = "0" + Integer.toHexString(dataByte & 0xff);
hexString.append(hexByte.substring(hexByte.length() - 2));
}