public static void main ( String [ ] args ) { if ( args . length != 4 ) { System . err . println ( "Usage java " + SumStatsByMillisecondsFormular . class . getName ( ) + " file msSecColumn calculateCol sumByMillisec" ) ; System . exit ( - 1 ) ; } File file = Paths . get ( args [ 0 ] ) . toFile ( ) ; try { if ( ! file . exists ( ) ) { throw new FileNotFoundException ( file . getAbsolutePath ( ) ) ; } int timeMsIndex = Integer . parseInt ( args [ 1 ] ) ; int calculateColumn = Integer . parseInt ( args [ 2 ] ) ; long milliseconds = Long . parseLong ( args [ 3 ] ) ; SumStatsByMillisecondsFormular formular = new SumStatsByMillisecondsFormular ( timeMsIndex , calculateColumn , milliseconds ) ; new CsvReader ( file ) . calc ( formular ) ; System . out . println ( formular ) ; } catch ( NumberFormatException e ) { System . err . println ( "Checks timeMsIndex:" + args [ 1 ] + ",calculateColumn:" + args [ 2 ] + " and milliseconds:" + args [ 3 ] + " are valids numbers error:" + e ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Usages file msSecColumn calculateCol sumByMillisec