Here you can find the source of toLong(String s, long defValue)
public static long toLong(String s, long defValue)
//package com.java2s; //License from project: Apache License public class Main { public static long toLong(String s, long defValue) { Long result = toLong(s);// w w w .j a v a 2 s. c om return ((result != null) ? result.longValue() : defValue); } public static Long toLong(String s) { if (s != null) try { return Long.valueOf(s); } catch (NumberFormatException e) { } return null; } }