code: public static long readLongFromFile(File file) throws IOException {
      try (FileInputStream fis = new FileInputStream(file);
           BufferedReader br = new BufferedReader(
             new InputStreamReader(fis, Charset.forName("UTF-8")))) {
        long value = Long.parseLong(br.readLine());
        return value;
      }
    }
docs: Reads a long integer from a file that was created by the
  {@link #writeLongToFile(long, File) writeIntToFile} method.
  
  @param file file to read the integer value from.
  @return the long integer value in the file
  @throws IOException if an I/O error occurs.