Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. public class Arrays
  2. {
  3.     public static void main(String [] args)
  4.     {
  5.         System.out.print(test());
  6.  
  7.     }
  8.     static boolean test()
  9.     {
  10.         int[] arA = {1,2,3};
  11.         int[] arB = {1,2,3};
  12.        
  13.         boolean exist = false;
  14.        
  15.         for(int i = 0; i <= arA.length  - 1; i++)
  16.         {
  17.             exist = false;
  18.             for(int j = 0; j <= arB.length  - 1; j++)
  19.             {
  20.                 if (arA[i] == arB[j])
  21.                 {
  22.                     exist = true;
  23.                     break;
  24.                 }
  25.                
  26.            
  27.             }
  28.             if (exist)
  29.             {
  30.                 System.out.print(arA[i] + " from arA exist in arB \n");
  31.             }
  32.             else
  33.             {
  34.                 System.out.print(arA[i] + " from arA not exist in arB \n");
  35.                 return false;
  36.             }
  37.            
  38.         }
  39.         return true;
  40.     }      
  41.    
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement