return matching index array

Solutions on MaxInterview for return matching index array by the best coders in the world

showing results for - "return matching index array"
Bloom
15 Apr 2018
1public class compareArray{
2  public static void main(String[] args){
3    
4    int[a] = {1,4,5,7};
5    int[b] = {6,4,3,7};
6    
7    
8    int[] ab = new int[4];
9    
10    
11    for(int i = 0; i<a.length; i++; )
12    {   
13      if(a[i] == b[i])
14       { 
15        int[] ab = new int[4];
16        
17        Arraylist<Integer> al = new Arraylist<Integer>();
18        
19        for(int i = 0; i < a.length; i++; )
20          
21          if(a[i] == b[i])
22            
23          {  
24            al.add(a[i]);  
25                            }   
26                                  }
27      		Object[] c= al.toArray();
28      			
29      for(Object ob : c)
30      {
31        System.out.println(obj);
32      }
similar questions
queries leading to this page
return matching index array