Here you can find the source of convertStringToInteger(String value)
Parameter | Description |
---|---|
value | to convert to Integer |
Parameter | Description |
---|---|
IllegalArgumentException | if value is null or conversion is unsuccessful |
public static Integer convertStringToInteger(String value) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w.ja v a 2 s . c o m * This method convert String to Integer if value is null then {@link IllegalArgumentException} * is thrown. * * @param value to convert to Integer * @return integer value of String value given in parameter * @throws IllegalArgumentException if value is null or conversion is unsuccessful */ public static Integer convertStringToInteger(String value) throws IllegalArgumentException { Integer intValue = null; if (value == null) { throw new IllegalArgumentException(); } intValue = Integer.parseInt(value); return intValue; } }