Here you can find the source of toLong(Object object)
Parameter | Description |
---|---|
object | Can be null (returns 0) |
public static long toLong(Object object)
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w . j a v a 2 s . co m * Lenient convertor -- accepts String or any Number subclass. * @param object Can be null (returns 0) */ public static long toLong(Object object) { if (object == null) return 0; if (object instanceof Number) return ((Number) object).longValue(); return Long.valueOf((String) object); } }