Java Long Number Create toLong(String str, long defaultValue)

Here you can find the source of toLong(String str, long defaultValue)

Description

to Long

License

Apache License

Declaration

public static long toLong(String str, long defaultValue) 

Method Source Code

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

public class Main {

    public static long toLong(String str, long defaultValue) {
        if (str == null) {
            return defaultValue;
        }//from   w w  w .  j a v a 2s  .c o  m
        try {
            return Long.parseLong(str);
        } catch (NumberFormatException nfe) {
            return defaultValue;
        }
    }
}

Related

  1. toLong(String str)
  2. toLong(String str)
  3. toLong(String str)
  4. toLong(String str)
  5. toLong(String str)
  6. toLong(String str, long val)
  7. toLong(String string)
  8. toLong(String string)
  9. toLong(String string)