Java tutorial
//package com.java2s; public class Main { protected static int mGetIntValueOf(String pVal) { return mGetIntValueOf(pVal, 0); } protected static int mGetIntValueOf(String pVal, int pDefault) { if (pVal == null || pVal.isEmpty()) return pDefault; return (int) Integer.valueOf(pVal); } }