public static long readNumberFromFile ( final Path filePath ) throws IOException , NumberFormatException { final List < String > allLines = Files . readAllLines ( filePath ) ; if ( ! allLines . isEmpty ( ) ) { return Long . parseLong ( allLines . get ( 0 ) ) ; } else { throw new NumberFormatException ( "unable to parse empty file " + filePath . toString ( ) ) ; } }
Reads a number from a file .