Java Long Number Create toLong(Object objValue)

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

Description

to Long

License

Open Source License

Parameter

Parameter Description
objValue Object

Return

long

Declaration

public static long toLong(Object objValue) 

Method Source Code

//package com.java2s;
/*//from   w ww  .j a v  a  2 s.  c  o  m
 * Copyright 2005-2020 GreenTube Team All rights reserved.
 * Support: Huxg
 * License: CND team license
 */

public class Main {
    /**
     *
     *
     * @param objValue Object
     *
     * @return long
     */
    public static long toLong(Object objValue) {
        if (objValue != null) {
            if (objValue instanceof Number) {
                return ((Number) objValue).longValue();
            } else {
                return Long.parseLong(objValue.toString());
            }
        } else
            return 0;
    }

    /**
     * 
     *
     * @param objValue Object
     *
     * @return String
     */
    public static String toString(Object objValue) {
        if (objValue != null)
            return objValue.toString();
        else
            return null;
    }
}

Related

  1. toLong(Object object)
  2. toLong(Object object)
  3. toLong(Object object, Long defaultValue)
  4. toLong(Object object, long defaultValue)
  5. toLong(Object objectToConvert)
  6. toLong(Object oid)
  7. toLong(Object property, long defaultValue)
  8. toLong(Object val)
  9. toLong(Object value)