code: public static String readFileContents(File file) throws IOException {
  
          try (Scanner in = new Scanner(file)) {
              in.useDelimiter("\\Z");
              return (in.next());
          }       
      }
docs: Reads the contents of a File to a String.
  
  @param file the File instance to read the contents from
  @return the contents of file as a String
  @throws IOException if any errors occur while opening or reading the file