Guest User

Untitled

a guest
Apr 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public void create ()
  2. {
  3. for(int i = 0; i < size; i++)
  4. {
  5. rand = new Random ();
  6. v[i] = rand.nextInt(900);
  7. }
  8. print_array((char) 0);
  9. }
  10. public void print_array(char mode)
  11. {
  12. if (mode == 'f')
  13. {
  14. try
  15. {
  16. output = new PrintWriter (new File ("fil.txt"));
  17. }
  18. catch (Exception E)
  19. {
  20. System.err.println(E.getMessage());
  21. }
  22. for(int i=0;i<size;i++)
  23. ((PrintWriter) output).println(v[i]);
  24. output.close( );
  25.  
  26. }
  27. for(int i = 0; i <size; i++)
  28. {
  29. System.out.print(v[i] + " ");
  30.  
  31. if ( i%10 == 9)
  32. {
  33. System.out.println ("");
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment