Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 
avatar of R. Naired

R. Naired

R. Naired has asked 1 questions and find answers to 0 problems.

Stats

5
EtPoint
0
Vote count
1
questions
0
answers

About

public class Citire { final static int width = 5; final static int height = 5; public static void main(String[] args) throws IOException { FileReader inputStream = null; FileWriter outputStream = null;

    try {
        inputStream = new FileReader("input.txt");
        outputStream = new FileWriter("output .txt");

        int c;
        int contorw=0;
        int contorh=0;
        while ((c = inputStream.read()) != -1) {
            outputStream.write(c);
            contorw++;
            if(contorw%width==0){
                outputStream.write("\n");
                contorh++;
            }
        }
    } finally {
        if (inputStream != null) {
            inputStream.close();
        }
        if (outputStream != null) {
            outputStream.close();
        }
    }
}

}

R. Naired answers