Advertisement
Josif_tepe

Untitled

Mar 25th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.logging.Filter;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) throws IOException{
  7.             InputStream in = new FileInputStream("izvor.txt");
  8.              BufferedInputStream bis = new BufferedInputStream(in);
  9.             OutputStream out = new FileOutputStream("destinacija.txt");
  10.              BufferedOutputStream bos = new BufferedOutputStream(out);
  11.  
  12.              BufferedReader bf = new BufferedReader(new InputStreamReader(bis));
  13.  
  14.              while(bf.ready()) {
  15.                  String s = bf.readLine();
  16.                  if(s.charAt(0) >= '0' && s.charAt(0) <= '9') {
  17.                      bos.write(s.getBytes());
  18.                      bos.write(10);
  19.                  }
  20.              }
  21.             bos.flush();
  22.              bis.close();
  23.              bos.close();
  24.  
  25.         }
  26.  
  27.     }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement