Java Long Number Create toLong(Object obj)

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

Description

to Long

License

Open Source License

Declaration

static Long toLong(Object obj) 

Method Source Code

//package com.java2s;

public class Main {
    static Long toLong(Object obj) {
        if (obj instanceof String)
            return Long.parseLong((String) obj);
        if (obj instanceof Byte) {
            Byte b = (Byte) obj;
            return b.longValue();
        }/*from   www  .j av  a2 s  .c o  m*/
        if (obj instanceof Short) {
            Short s = (Short) obj;
            return s.longValue();
        }
        if (obj instanceof Integer) {
            Integer i = (Integer) obj;
            return i.longValue();
        }
        return (Long) obj;
    }
}

Related

  1. toLong(Object o)
  2. toLong(Object o)
  3. toLong(Object o)
  4. toLong(Object ob, Long defaultLong)
  5. toLong(Object obj)
  6. toLong(Object obj)
  7. toLong(Object obj)
  8. toLong(Object obj)
  9. toLong(Object obj)