使用DataInputStream从文件读取int
/** from 时 代 J a v a 公 众 号 - nowjava.com**/ import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { public static void main(String[] args) { String strFilePath = "C://Folder//readInt.txt"; try { FileInputStream fin = new FileInputStream(strFilePath); DataInputStream din = new DataInputStream(fin); int i = din.readInt(); System.out.println("int : " + i); din.close(); }catch(FileNotFoundException fe){// from 时 代 J a v a - nowjava.com System.out.println(