Here you can find the source of toInt(final String value)
Parameter | Description |
---|---|
value | the value |
public static int toInt(final String value)
//package com.java2s; //License from project: Apache License public class Main { /**// ww w. jav a 2 s . c om * To int. * * @param value the value * @return the int */ public static int toInt(final String value) { return (int) toLong(value); } /** * To long. * * @param value the value * @return the long */ public static long toLong(final String value) { if (value == null) { return 0L; } String szTemp = ""; for (int i = 0; i < value.length(); i++) if (value.charAt(i) != ',') { szTemp = szTemp + value.charAt(i); } try { final double dd = Double.parseDouble(szTemp); final long l1 = (long) dd; return l1; } catch (final NumberFormatException e) { final long l = 0L; return l; } } }