fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import static java.lang.Math.random;
  7. import java.math.BigDecimal;
  8. import java.math.RoundingMode;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class Ideone
  12. {
  13. public static int ppr=3;
  14. public static int fun=5;
  15. public static double maxx=10.0;
  16. public static void main (String[] args) throws java.lang.Exception
  17. {
  18. for(int j=0; j<fun; j++)
  19. {
  20. for(int i=0; i<ppr; i++)
  21. {
  22. BigDecimal bd = new BigDecimal(random()*maxx);
  23. bd = bd.setScale(2, RoundingMode.HALF_UP);
  24. System.out.print(bd.doubleValue()+"\t");
  25. }
  26. System.out.println();
  27. }
  28. }
  29. }
Success #stdin #stdout 0.11s 320512KB
stdin
Standard input is empty
stdout
2.55	0.83	2.78	
6.63	7.06	7.61	
1.66	3.17	3.32	
4.58	8.11	7.97	
7.85	0.58	7.54