Write code to parse Integer from String
//package com.book2s; public class Main { public static void main(String[] argv) { String str = "book2s.com"; System.out.println(getIntegerByStr(str)); }/*from w w w . j av a2 s.com*/ public static Integer getIntegerByStr(String str) { try { Integer temp = Integer.parseInt(str); return temp; } catch (Exception e) { return null; } } }