class Hex {

	public static int fromString (String s) {
		if ( s.length() != 2 ) return 0;

		int b = 0;
		b = (Character.digit(s.charAt(0), 16) << 4)
				+  (Character.digit(s.charAt(1), 16));

		return b;
	}

}