fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. int[] first = {5,2,3,1};
  10. int[] other = {3,2,1,5};
  11. boolean status = false;
  12. if (first.length == other.length)
  13. {
  14. for(int i = 0; i < first.length; i++)
  15. {
  16. status = false;
  17. for(int j = 0; j < other.length; j++)
  18. {
  19. if (other[j] == first[i])
  20. {
  21. status = true;
  22. break;
  23. }
  24. }
  25. if (!status)
  26. {
  27. break;
  28. }
  29. }
  30. }
  31. if (status)
  32. {
  33. System.out.println("Há correspondencia nos dois arrays");
  34. }
  35. else
  36. {
  37. System.out.println("Não Há correspondencia nos dois arrays");
  38. }
  39. }
  40. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
Há correspondencia nos dois arrays