Java Long Number Create toLong(Object expectInt)

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

Description

to Long

License

Apache License

Declaration

public static Long toLong(Object expectInt) 

Method Source Code

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

public class Main {
    public static Long toLong(Object expectInt) {
        if (expectInt != null) {
            try {
                return ((Number) expectInt).longValue();
            } catch (ClassCastException e) {
                if (expectInt instanceof String) {
                    try {
                        return Long.parseLong((String) expectInt);
                    } catch (NumberFormatException e1) {
                    }/*from  w  w w. j  av  a 2s.  c o m*/
                }
                return null;
            }
        }
        return null;
    }
}

Related

  1. toLong(Number n)
  2. toLong(Number num)
  3. toLong(Object _inStrObj)
  4. toLong(Object _value, long _default)
  5. toLong(Object cell)
  6. toLong(Object num)
  7. toLong(Object num, long defValue)
  8. toLong(Object number)
  9. toLong(Object o)