fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone {
  9. public static void main(String[] args) {
  10. int massiv[] = new int[20];
  11. System.out.print("["); // здесь первая скобка
  12. for (int i = 0; i < massiv.length; i++) {
  13. massiv[i] = sluchaynoeCeloe();
  14. System.out.print(massiv[i] + ", "); // собственно, запятые
  15. if (i == massiv.length - 1) // это вообще стыдно показывать
  16. System.out.print(massiv[i]);
  17. }
  18. System.out.println("]"); // ну и, последний штрих!
  19. }
  20.  
  21. public static int sluchaynoeCeloe() {
  22. int a = -7, b = 13;
  23. return (int)(Math.random() * (b + (Math.abs(a) + 1))) - Math.abs(a);
  24. }
  25. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
[6, 9, -2, 5, 8, 1, 1, -4, 3, 3, 8, 6, 13, 10, 5, 6, 0, 3, 8, 11, 11]