public static long parseLongDefault(final String s,final long def){
  if (s == null) {
    return def;
  }
  long r;
  try {
    r=Long.parseLong(s);
  }
 catch (  final NumberFormatException e) {
    r=def;
  }
  return r;
}

public static long parseLongDefault ( final String s , final long def ) { if ( s == null ) { return def ; } long r ; try { r = Long . parseLong ( s ) ; } catch ( final NumberFormatException e ) { r = def ; } return r ; }
parses a long safely . returning a default if nothing can be sanely parsed from it
