代码:
File file = new File("E://test.txt");
InputStream is = new FileInputStream(file);
byte[] b = new byte[1024];
int a = is.read(b);
String[] str = new String(b,0,a).split("");
for(int i=0;i<str.length;i++){
if("是".equels(str[i])){ count++ }
}
System.out.println("文件中是的个数为:"+count);