Guest User

Untitled

a guest
Feb 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. public class Solution {
  2.  
  3. public static void main(String[] args) throws IOException {
  4.  
  5. BufferedReader reader = new BufferedReader (new InputStreamReader (System.in));
  6. String file1 = reader.readLine ();
  7. String file2 = reader.readLine ();
  8. reader.close ();
  9.  
  10. FileInputStream fileInputStream = new FileInputStream (file1);
  11. FileOutputStream fileOutputStream = new FileOutputStream (file2);
  12.  
  13. ArrayList<String> list = new ArrayList<String> ();
  14. byte[] buffer1 = new byte[fileInputStream.available ()];
  15. while (fileInputStream.available () > 0) {
  16. fileInputStream.read (buffer1);
  17. }
  18.  
  19. String temp = new String (buffer1);
  20. for (String z : temp.split(" ")) {
  21. float x = Float.parseFloat(z);
  22. list.add(Math.round(x) + " ");
  23. }
  24.  
  25. for (String h : list) {
  26. fileOutputStream.write(h.getBytes());
  27. }
  28.  
  29. fileInputStream.close ();
  30. fileOutputStream.close ();
  31. }
  32. }
  33.  
  34. byte[] buffer1 = ...
  35. String temp = new String (buffer1);
Add Comment
Please, Sign In to add comment