Hint: Look at this line
digitpercentage [p] = calculateLeadingDigit ((int) numbers [p])/numbers.length;
value ranges from 0 to 9. But does
length varies same? You do
, is not there a possibility of index out of range?
Debug step wise and see how the execution is happening and what are the values assigned.