Java String to Int convertStringToInteger(String value)

Here you can find the source of convertStringToInteger(String value)

Description

This method convert String to Integer if value is null then IllegalArgumentException is thrown.

License

Open Source License

Parameter

Parameter Description
value to convert to Integer

Exception

Parameter Description
IllegalArgumentException if value is null or conversion is unsuccessful

Return

integer value of String value given in parameter

Declaration

public static Integer convertStringToInteger(String value) throws IllegalArgumentException 

Method Source Code

//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;
    }
}

Related

  1. convertStringToInteger(String s)
  2. convertStringToInteger(String s)
  3. convertStringToInteger(String string)
  4. convertStringToInteger(String strParaConvert)
  5. convertStringToInteger(String value)
  6. convertStringToInteger(String value)