hex To Decimal
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; class Main { public static final String HEX_DIGITS = "0123456789ABCDEF"; public static String hexToDec(String hex) { char[] sources = hex.toCharArray(); int dec = 0; for (int i = 0; i < sources.length; i++) { int digit = HEX_DIGITS.indexOf(Character.toUpperCase(sources[i])); dec += digit * Math.pow(16, (sources.length - (i + 1))); } return String.valueOf(dec); } }