protected long safeLong(Map<String,Number> map,String key){
  Number val=map.get(key);
  if (val == null)   return -1;
  return val.longValue();
}

protected long safeLong ( Map < String , Number > map , String key ) { Number val = map . get ( key ) ; if ( val == null ) return - 1 ; return val . longValue ( ) ; }
safely gets long value by given key .
