我有一个文件,其中包含以十六进制表示的整数,有任何方法可以将所有这些数字存储到整数数组中.
我知道你可以说int i = 0x
但在阅读我得到错误的值时,我不能这样做?
提前致谢!
我有这个代码
Scanner scanner = new Scanner("hello.txt");
while(scanner.hasNextInt()){
int i = scanner.nextInt();
System.out.println(i);
}
Run Code Online (Sandbox Code Playgroud)
我在hello.txt中的数据值是
1 2 3 22 33 123
但是当我运行程序时,没有输出.有什么我不使用/代码行?
我有以下情况
Scanner scanner = new Scanner(new File("hello.txt"));
while(scanner.hasNextInt()){
int i = scanner.nextInt();
System.out.println(i);
}
Run Code Online (Sandbox Code Playgroud)
我运行时为什么会出错?它说file not found (The system cannot find the files specificed)在java.io.fileinputstream.但该文件确实存在.
java ×3