You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
813 B

  1. import java.math.BigDecimal;
  2. public class LargeDecimals
  3. {
  4. public BigDecimal maxOfMins( BigDecimal[][] table )
  5. {
  6. BigDecimal[] n1=new BigDecimal[table.length];
  7. BigDecimal min= new BigDecimal("0.0");
  8. BigDecimal max2= new BigDecimal("0.0");
  9. int index=0;
  10. int i;
  11. int j;
  12. int k;
  13. for( i=0;i<table.length;i++)
  14. {
  15. min=table[i][0];
  16. for( j=0;j<table.length-1;j++)
  17. {
  18. if(table[i][j].compareTo(min)==-1)
  19. {
  20. min=table[i][j];
  21. n1[index]=min;
  22. index++;
  23. }
  24. }
  25. }
  26. for(k=0;k<n1.length;k++)
  27. {
  28. System.out.print(n1[k]+" ");
  29. if(n1[k].compareTo(max2)==1)
  30. {
  31. max2=n1[k];
  32. }
  33. }
  34. return max2;
  35. }
  36. }