Scanner Sc = new Scanner(new File("Input.bin"));
String s = Sc.nextLine();
fsize = Integer.parseInt(s); // Reads 4
s = Sc.nextLine();
int mapSize = Integer.parseInt(s); // Reads 3
for (int i = 0; i < mapSize; i++)
{
byte value = 0;
value = Sc.nextByte(); // Here it is throwing the exception it should have
// print the ascii of 'b' which is 98????
String key = Sc.nextLine();
key = key.trim();
dcMap.put(key, (char)value);
// System.out.println(key + " " + (char)value);
}
Input.bin文件内容:
4
3
b 0
c 10
a 11