fork 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. {
  10.  
  11. public static boolean[ ] getFatoresB ( int [ ] valores ) {
  12. boolean[ ] saida = new boolean [ valores.length ];
  13. for ( int i = 0 ; i < valores.length ; i++){
  14. boolean valido = true;
  15. try {
  16. int b = valores[i];
  17. int c = valores[i] / 2;
  18. int d = valores[i] / 3;
  19. int e = b / ( c-d );
  20. } catch ( Exception ex ) {
  21. valido = false;
  22. } finally {
  23. saida[i] = valido;
  24. }
  25.  
  26. }
  27. return saida;
  28. }
  29.  
  30. public static void main (String[] args) throws java.lang.Exception
  31. {
  32. int[] arr = {1,2,3,4};
  33. boolean[] b = getFatoresB(arr);
  34. for(int i = 0; i < b.length;i++){
  35. System.out.println(b[i]);
  36. }
  37. }
  38. }
Success #stdin #stdout 0.04s 2184192KB
stdin
Standard input is empty
stdout
false
true
false
true