I have an array of positive/negative ints
int[] numbers = new int[10]; numbers[0] = 100; numbers[1] = -34200; numbers[2] = 3040; numbers[3] = 400433; numbers
you are very close. I think the initial value of 'distance' should be a big number instead of 0. And use the absolute value for the cdistance.