package practise;
public class main1 {
public static int[] arr(int[] b,int data, int si,int count)
{
if(si==b.length)
{
int[] bb=new int[count];
return bb;
}
int[] index=null;
if(b[si]==data)
{
index=arr(b,data,si+1,count++);
}
else
{
index=arr(b,data,si+1,count);
}
if(b[si]==data)
{
index[count]=si;
}
return index;
}
public static void main(String[] args) {
int[] result = {1,8,8,2,5,4,8,5};
int[] check=arr(result,8,0,0);
for(int i : check)
{
System.out.print(i+" ");
}
}
}