算法之将一个16进制的字符串转换成整数返回
public class HexToInt { public static void main(String[] args) { String str = "13abf"; convert(str); } private static int convert(String str) { int len = str.length(); int sum = 0; for (int i = 0; i < len; i++) { char c = str.charAt(len-1-i); int n = Character.digit(c, 16); sum += n*(1<<(4*i)); } return sum; } }