Given the following method
public int countSomething (int[] p)
{
int count = 0;
for (int i = 0 ; i < p.length ; i++)
{
count++;
int j = p [i];
while (j != i)
{
j = p [i];
count++;
}
}
System.out.println (count);
retu count;
}
int[] arr = {0, 2, 3, 1};
I know countSomething(arr) retus 10 but I am not sure why. Can anyone explain the logic used to retu 10?
