
org.opentripplanner.framework.text.HexString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
The newest version!
package org.opentripplanner.framework.text;
/**
* Converts a byte array to its hexadecimal representation
*/
public class HexString {
private static final char[] HEX_CHARS = "0123456789abcdef".toCharArray();
private HexString() {}
public static String of(byte[] data) {
// two characters form the hex value.
StringBuilder out = new StringBuilder(data.length * 2);
for (byte b : data) {
out.append(HEX_CHARS[(0xF0 & b) >>> 4]);
out.append(HEX_CHARS[0x0F & b]);
}
return out.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy