Java Long Number Create toLong(Object obj)

Here you can find the source of toLong(Object obj)

Description

to Long

License

BSD License

Declaration

public static long toLong(Object obj) 

Method Source Code

//package com.java2s;
/*L//  w w w  .  j  ava 2  s .co m
 * Copyright Georgetown University, Washington University.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/cab2b/LICENSE.txt for details.
 */

public class Main {
    public static long toLong(Object obj) {
        long value = 0;
        if (obj != null) {
            String objVal = String.valueOf(obj);
            if (objVal.length() > 0) {
                Long intObj = Long.parseLong(objVal);
                value = intObj.longValue();
            }
        }
        return value;

    }
}

Related

  1. toLong(Object ob, Long defaultLong)
  2. toLong(Object obj)
  3. toLong(Object obj)
  4. toLong(Object obj)
  5. toLong(Object obj)
  6. toLong(Object obj)
  7. toLong(Object obj)
  8. toLong(Object obj)
  9. toLong(Object obj)