Java Long Number Create toLong(Number num)

Here you can find the source of toLong(Number num)

Description

Convert the given number into a Long instance.

License

Open Source License

Parameter

Parameter Description
num A Number instance.

Return

A instance equivalent to the given number. null if num is null .

Declaration

public static Long toLong(Number num) 

Method Source Code

//package com.java2s;
/*/*from  w  ww  . j a  v  a2 s  .  co  m*/
 * Copyright (c) 2015 NEC Corporation
 * All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this
 * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
 */

public class Main {
    /**
     * Convert the given number into a {@link Long} instance.
     *
     * @param num  A {@link Number} instance.
     * @return  A {@link Long} instance equivalent to the given number.
     *          {@code null} if {@code num} is {@code null}.
     */
    public static Long toLong(Number num) {
        return (num == null) ? null : Long.valueOf(num.longValue());
    }
}

Related

  1. toLong(int[] x, int length, int M)
  2. toLong(Integer i)
  3. toLong(long[] array)
  4. toLong(Number n)
  5. toLong(Number n)
  6. toLong(Object _inStrObj)
  7. toLong(Object _value, long _default)
  8. toLong(Object cell)
  9. toLong(Object expectInt)