/*
 *  Copyright 2014 Eric F. Savage, code@efsavage.com
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
package com.ajah.util;

/**
 * Utilities for dealing with numbers.
 * 
 * @author <a href="http://efsavage.com">Eric F. Savage</a>, <a
 *         href="mailto:code@efsavage.com">code@efsavage.com</a>.
 * 
 */
public class NumberUtils {

	/**
	 * Parses an int out of a String, falling back to a default value if the
	 * string is null, empty, or not a number.
	 * 
	 * @param value
	 *            The value to parse.
	 * @param defaultValue
	 *            The value to use if no valid int could be parsd.
	 * @return The parsed value, or the specified default.
	 */
	public static int safeInt(String value, int defaultValue) {
		if (StringUtils.isBlank(value)) {
			return defaultValue;
		}
		try {
			return Integer.parseInt(value);
		} catch (NumberFormatException e) {
			return defaultValue;
		}
	}

}

@@ -1433,10 +1433,610 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09/**%0A%09 * Parses an array of Strings into an array of ints.%0A%09 * %0A%09 * @param strings%0A%09 *            An array of strings, may be null or empty, but should not%0A%09 *            contain null values.%0A%09 * @return The array of ints, will be null if null is passed in.%0A%09 * @throws NumberFormatException%0A%09 *             If any of the strings cannot be parsed.%0A%09 */%0A%09public static int%5B%5D parseInts(String%5B%5D strings) %7B%0A%09%09if (strings == null) %7B%0A%09%09%09return null;%0A%09%09%7D%0A%09%09int%5B%5D ints = new int%5Bstrings.length%5D;%0A%09%09for (int i = 0; i %3C strings.length; i++) %7B%0A%09%09%09ints%5Bi%5D = Integer.parseInt(strings%5Bi%5D);%0A%09%09%7D%0A%09%09return ints;%0A%09%7D%0A%0A
 %7D%0A

Add parseInts() method