Java Integer Convert To convertInt(String str, int radix)

Here you can find the source of convertInt(String str, int radix)

Description

convert Int

License

Open Source License

Declaration

public static Number convertInt(String str, int radix) throws NumberFormatException 

Method Source Code

//package com.java2s;

public class Main {
    public static Number convertInt(String str, int radix) throws NumberFormatException {
        long x = Long.parseLong(str, radix);
        if (x <= (long) Integer.MAX_VALUE && x >= (long) Integer.MIN_VALUE) {
            return new Integer((int) x);
        }//from  w w  w .ja  v  a2s  . c  o  m
        return new Long(x);
    }
}

Related

  1. convertInt(byte[] data)
  2. convertInt(byte[] data)
  3. convertInt(String str, int defaults)
  4. convertInt(String value)
  5. convertInt(String valueAsString)
  6. convertInt(String[] idArray)
  7. convertInt2Byte(int data)