Using plain Java, a String can be converted to int as in this example:
int nr; try { nr = Integer.parseInt(theGivenString); } catch (NumberFormatException e) { // handle exception }