Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws ParseException, IOException {
- BufferedReader br = new BufferedReader(new FileReader("primes.csv"));
- String line = null;
- Hashtable<String, String> map = new Hashtable<String, String>(100);
- while((line = br.readLine()) != null){
- String str[] = line.split(",");
- map.put(str[0], str[1]);
- }
- br.close();
- System.out.println(map);
- int k;
- k = Integer.parseInt(JOptionPane.showInputDialog(f,"Enter an integer k whee"
- + " 3 < k < 1229: "));
- while (k <= 3 || k >= 1229){
- k = Integer.parseInt(JOptionPane.showInputDialog(f,"Sorry try again: "));
- }
- JOptionPane.showMessageDialog(f, "The "+ k +"th prime number is " + map.get(k));
- }
- String str[] = line.split(",");
- ...
- map.put(str[0], str[1]);
- ...
- int k;
- ...
- map.get(k);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement