Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Scanner;
- public class HW01_2 {
- public static void main(String args[]) {
- File fout;
- File f;
- FileInputStream in=null;
- OutputStream out=null;
- try{
- f=new File("G:\\imenik\\izvor.txt");
- fout=new File("G:\\imenik\\destination.txt");
- in=new FileInputStream(f);
- out=new FileOutputStream(fout);
- ArrayList<Character> tekst=new ArrayList<>();
- Character c;
- while(in.available()>0){
- c=(char)in.read();
- tekst.add(c);
- }
- Collections.reverse(tekst);
- for(Character i:tekst) {
- out.write((int) i);
- }
- out.flush();
- out.close();
- in.close();
- }
- catch (Exception e){
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement