20145226夏艺华 《Java程序设计》 课堂实践

20145226夏艺华 《Java程序设计》 课堂实践_第1张图片
20145226夏艺华 《Java程序设计》 课堂实践_第2张图片

手速慢了一秒,泪流成河。。。打水印的时间用太多了

/**
 * Created by XiaYihua on 2017/5/31.
 */

import java.io.*;

public class FilereadDemo {
    public static void main(String [] args) throws IOException{
        FileInputStream fis = new FileInputStream(args[3]);
        int i = 0;
        while(true){
            if(i%16==0) System.out.print("0000"+i);
            i++;
            int ch = fis.read();
            if(ch==-1) break;
            System.out.print((char)(ch) + " ");
            if(i%16==0) System.out.println();
        }
        fis.close();
    }
}

你可能感兴趣的:(20145226夏艺华 《Java程序设计》 课堂实践)