Android examples for java.lang:Hex
Convert hex string to Int
//package com.java2s; public class Main { public static int toInt(String hex) { int ss = 0; if ((hex.charAt(0) - 'A') >= 0) { ss += (hex.charAt(0) - 'A' + 10) * 16; } else {/*www . j ava2s. co m*/ ss += (hex.charAt(0) - '0') * 16; } if ((hex.charAt(1) - 'A') >= 0) { ss += hex.charAt(1) - 'A' + 10; } else { ss += hex.charAt(1) - '0'; } return ss; } public static int toInt(byte b) { return (int) b & 0xFF; } }