# Simple program that checks if a number has same digits as its triple?

Hello, I'm trying to make a program that checks if a number has the same digits as its triple, so 16374, if its triple were 36471 would return true. The two numbers are put into a array and this is code to check it:

public static boolean check (int[]number, int[] third, int digits)

{

int matches=0;

int i=0;

int j=0;

while (i

while (number[i]!=third[j]&&j

i++;

if (j

}

if (matches==digits)

return true;

return false;

}

I've looked over it many times and tried for loops as well, but it seems that matches never ++ and always returns true if I set (matches==0).