/* convert a hex String to int */ // Note, there is no lead 0x, case-insensitive String g = "af0c99"; int i = Integer.parseInt( g.trim(), 16 /* radix */ );