Here you can find the source of toLong(String str)
public static Long toLong(String str)
//package com.java2s; //License from project: Apache License public class Main { public static Long toLong(String str) { if (str == null || str.length() == 0) { return null; } else {/*from www .j a va 2s. c o m*/ return Long.parseLong(str); } } public static long toLong(Long num) { if (num == null) { return 0; } else { return num.longValue(); } } public static long toLong(Double num) { if (num == null) { return 0; } else { return num.longValue(); } } public static long toLong(Double num, int def) { if (num == null) { return def; } else { return num.longValue(); } } }