Here you can find the source of getInt(Properties props, String name)
public static int getInt(Properties props, String name)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static int getInt(Properties props, String name) { if (props.containsKey(name)) { return getInt(props, name, -1); }//from w w w . j a v a2 s .co m throw new IllegalArgumentException("Missing required property '" + name + "'"); } public static int getInt(Properties props, String name, int defaultValue) { return getIntInRange(props, name, defaultValue, Integer.MIN_VALUE, Integer.MAX_VALUE); } public static int getIntInRange(Properties props, String name, int defaultValue, int min, int max) { int v = defaultValue; if (props.containsKey(name)) { v = Integer.valueOf(props.getProperty(name)); } if (v >= min && v <= max) { return v; } throw new IllegalArgumentException(name + " has value " + v + " which is not in the range"); } }