import org.apache.commons.lang.math.NumberUtils; public class MainClass { public static void main(String[] args) { //Convert String to int. If value invalid, return default value. System.out.println("String to Int >>> " + NumberUtils.toInt("ABCD", 77)); } }
String to Int >>> 77