public static long[] splitLongs(String str) throws IllegalArgumentException {
  StringTokenizer tokenizer=new StringTokenizer(str,",");
  int n=tokenizer.countTokens();
  long[] list=new long[n];
  for (int i=0; i < n; i++) {
    String token=tokenizer.nextToken();
    list[i]=Long.parseLong(token);
  }
  return list;
}

public static long [ ] splitLongs ( String str ) throws IllegalArgumentException { StringTokenizer tokenizer = new StringTokenizer ( str , "," ) ; int n = tokenizer . countTokens ( ) ; long [ ] list = new long [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { String token = tokenizer . nextToken ( ) ; list [ i ] = Long . parseLong ( token ) ; } return list ; }
parse comma - separated list of longs and return as array .
