List of usage examples for java.lang NumberFormatException printStackTrace
public void printStackTrace()
From source file:Main.java
public static String octalStringToDecimalString(String octal) { String decimal = "0"; try {//from ww w. j a va 2s. com decimal = Integer.valueOf(octal, 8).toString(); } catch (NumberFormatException e) { e.printStackTrace(); } return decimal; }
From source file:Main.java
public static String decimalIntToBinaryString(int i) { String str = "0"; try {//from www . jav a2 s .com str = Integer.toBinaryString(i); } catch (NumberFormatException e) { e.printStackTrace(); } return str; }
From source file:Main.java
public static String decimalIntToHexString(int decimal) { String str = "0"; try {/* www . j a v a 2 s .c o m*/ str = Integer.toHexString(decimal); } catch (NumberFormatException e) { e.printStackTrace(); } return str; }
From source file:Main.java
public static int getAndroidSDKVersion() { int version = 0; try {/*from w w w. j av a2 s . c om*/ version = Integer.valueOf(android.os.Build.VERSION.SDK); } catch (NumberFormatException e) { e.printStackTrace(); } return version; }
From source file:Main.java
public static int canParseInt(String number) { int result = Integer.MIN_VALUE; try {//from w w w .j av a2 s.co m result = Integer.parseInt(number); } catch (NumberFormatException e) { e.printStackTrace(); } return result; }
From source file:Main.java
public static String subDateMounth(String mBillDate) { int mounth = 0; try {//from www. j a v a2 s .co m String mMounth = mBillDate.substring(4, 6); mounth = Integer.parseInt(mMounth); } catch (NumberFormatException e) { e.printStackTrace(); } return mounth + ""; }
From source file:Main.java
public static int getAndroidSDKVersion() { int version = 0; try {// w w w . j a v a2 s . co m version = Integer.valueOf(android.os.Build.VERSION.SDK_INT); } catch (NumberFormatException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return version; }
From source file:Main.java
public static int getInt(String str, int def) { try {/* w ww .j av a2s. c o m*/ if (str == null) { return def; } return Integer.parseInt(str); } catch (NumberFormatException e) { e.printStackTrace(); } return def; }
From source file:Main.java
public static float hexToFloat(String s) { int intBits = 0; float result = 0; try {//from w w w.ja v a 2 s . c o m intBits = Integer.parseInt(s, 16); result = Float.intBitsToFloat(intBits); } catch (NumberFormatException e) { e.printStackTrace(); } return result; }
From source file:Main.java
public static final double objectToDouble(Object o) { if (o instanceof Number) return ((Number) o).doubleValue(); try {//w w w.j av a 2s .c om if (o == null) return -1D; else return Double.parseDouble(o.toString()); } catch (NumberFormatException e) { e.printStackTrace(); return -1D; } }