private static int findClosestIndex(final float scale,final float[] scalings){
  float currentMinDiff=Float.MAX_VALUE;
  int closest=0;
  for (int i=0; i < scalings.length - 1; i++) {
    final float diff=Math.abs(scalings[i] - scale);
    if (diff < currentMinDiff) {
      currentMinDiff=diff;
      closest=i;
    }
  }
  return closest;
}

private static int findClosestIndex ( final float scale , final float [ ] scalings ) { float currentMinDiff = Float . MAX_VALUE ; int closest = 0 ; for ( int i = 0 ; i < scalings . length - 1 ; i ++ ) { final float diff = Math . abs ( scalings [ i ] - scale ) ; if ( diff < currentMinDiff ) { currentMinDiff = diff ; closest = i ; } } return closest ; }
locate scaling value closest to current scaling setting
