There is an array
int[] array = new int[]{6,4,10,7,7,9};
and number 8.
I want to sort an array around 8 by the closest number.
nearest numbers: 9,7,7,10,6,4 respectively
because 9-1 = 8, 7 + 1 = 8, 7 + 1 = 8, 10-2 = 8, 6 + 2 = 8, 4 + 4 = 8
how can i sort these numbers. any idea?
source
share