Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package prikladek;
- import java.io.*;
- import java.util.Arrays;
- import java.util.TreeMap;
- /**
- *
- * @author Tom
- */
- public class Prikladek {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws FileNotFoundException, IOException {
- TreeMap<String, Integer> map = new TreeMap<String, Integer>();
- BufferedReader rd = new BufferedReader(new FileReader("tabulka.txt"));
- String s;
- while ((s = rd.readLine()) != null) {
- String[] pole = s.split("[\t]");
- map.put(pole[0], Integer.parseInt(pole[1]));
- }
- rd.close();
- System.out.println(map);
- BufferedReader rd2 = new BufferedReader(new FileReader("zprava.txt"));
- String vstup = rd2.readLine();
- String retezec = "";
- for (int i = 0; i < vstup.length(); i++) {
- retezec += String.valueOf(map.get(String.valueOf(vstup.charAt(i)))) + " ";
- }
- System.out.println(retezec);
- rd2.close();
- }
- }
Add Comment
Please, Sign In to add comment