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

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

Description

convert Int

License

Apache License

Declaration

static int convertInt(String str, int defaults) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    static int convertInt(String str, int defaults) {
        if (str == null) {
            return defaults;
        }//  w  ww  . ja va  2 s .  com
        try {
            return Integer.parseInt(str);
        } catch (Exception e) {
            return defaults;
        }
    }
}

Related

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