code: public static float[] normalize (int[] values)
      {
          // Allocate storage for the normalized array
          float[] normalized = new float[values.length];
  
          // Determine the minimum and maximum
          int min = getMinValue(values);
          int max = getMaxValue(values);
          int spread = max - min;
  
          // If there is no spread, return a flat normalization
          if (spread == 0) {
              Arrays.fill(normalized, 1f);
              return normalized;
          }
  
          // Normalize each value in the input array
          for (int i = 0; i < values.length; i++) {
              normalized[i] = (values[i] - min) / (float) spread;
          }
          return normalized;
      }
docs: Normalizes an array of integers from the bounding [min,max] to
  [0.0, 1.0]. If min == max, all elements in the returned array
  will be 1f.