Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static int readFileToInt(String filename) {
- String fileContent = "1";
- BufferedReader br = null;
- try {
- try {
- br = new BufferedReader(new FileReader(filename));
- String line;
- while ((line = br.readLine()) != null) {
- fileContent = fileContent + line;
- }
- } catch (FileNotFoundException e) {
- System.out.println("File not found at " + filename);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- return Integer.parseInt(fileContent.replaceAll("[^0-9.]", ""));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement