String numWithComma = "1,234,567"; String regex = "(?<=\\d),(?=\\d)"; int num = new Integer(numWithComma.replaceAll(regex,""));