Here you can find the source of getFirstInt(String s)
public static Integer getFirstInt(String s)
//package com.java2s; //License from project: Open Source License import java.util.Scanner; public class Main { public static Integer getFirstInt(String s) { Scanner in = new Scanner(s).useDelimiter("[^0-9]+".intern()); if (in.hasNext()) { return in.nextInt(); } else {//from w w w . jav a 2 s . co m return null; } } }