Java Object to Long objectToLong(Object obj)

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

Description

object To Long

License

Apache License

Declaration

public static long objectToLong(Object obj) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static long objectToLong(Object obj) {
        return objectToLong(obj, 0);
    }/*  w ww. j a v  a2  s . com*/

    public static long objectToLong(Object obj, long added) {
        long result = 0;
        try {
            result = Long.parseLong(obj.toString());
        } catch (Exception e) {
            result = added;
        }
        return result;
    }
}

Related

  1. castToLong(final String uid)
  2. castToLong(Object object)
  3. castToLong(Object value)
  4. castToLong(Object value)
  5. castToLongArray(Object[] array)
  6. objectToPostiveLong(Object object)
  7. objectToShort(Object o)
  8. objectToShort(Object p1)