Java Long Number Create toLong(Object obj)

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

Description

Get the long value of this object, only if the object is an instance of Number

License

Open Source License

Parameter

Parameter Description
obj the object to be converted

Return

the long value of the object, or 0L if it is not a number.

Declaration

public static long toLong(Object obj) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   www .j a  va 2  s. c  o  m
     * Get the long value of this object, only if the object is an instance of Number
     *
     * @param obj the object to be converted
     * @return the long value of the object, or 0L if it is not a number.
     */
    public static long toLong(Object obj) {
        return (obj instanceof Number) ? ((Number) obj).longValue() : 0L;
    }
}

Related

  1. toLong(Object o)
  2. toLong(Object ob, Long defaultLong)
  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)