Here you can find the source of readKeyFile(String path)
public static Map<String, Integer> readKeyFile(String path) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { public static final String A_KEY = "aKey"; public static final String K_KEY = "kKey"; public static final String X0 = "x0"; public static Map<String, Integer> readKeyFile(String path) throws IOException { Map<String, Integer> result = new HashMap<String, Integer>(); List<String> lines = readLinesOfFile(path); for (int i = 0; i < lines.size(); i++) { String line = lines.get(i); if (line.startsWith(A_KEY)) { result.put(A_KEY, Integer.valueOf(line.split("=")[1])); } else if (line.startsWith(K_KEY)) { result.put(K_KEY, Integer.valueOf(line.split("=")[1])); } else if (line.startsWith(X0)) { result.put(X0, Integer.valueOf(line.split("=")[1])); }//from w ww. j a va 2 s .c o m } return result; } public static List<String> readLinesOfFile(String path) throws IOException { Path pathToFile = Paths.get(path); return Files.readAllLines(pathToFile, StandardCharsets.US_ASCII); } }