You can very well use StatUtils.normalize method within apache.commons.math3 library
Refer the following documentation
https://commons.apache.org/proper/commons-math/javadocs/api-3.4/org/apache/commons/math3/stat/StatUtils.html#normalize(double[])
Gradle dependency is as follows
implementation 'org.apache.commons:commons-math3:3.6.1'
Maven Dependency
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
Example
public static void main(String[] args) {
double[] arr = new double[]{900.68, 900.63, 900.74, 900.59, 900.49, 900.65, 900.81, 900.82, 901.03, 900.74, 900.66, 900.49, 900.52, 900.63, 900.45};
double normArr[] = StatUtils.normalize(arr);
for (int i = 0; i < normArr.length; i++) {
System.out.print(normArr[i] + ", ");
}
}
This would print out the values : 0.11787856446848383, -0.20956189238965656, 0.5108071126989968, -0.47151425787616885, -1.1263951715931941, -0.0785857096464004, 0.9692237523003934, 1.034711843672766, 2.4099617624777, 0.5108071126989968, -0.013097618274772323, -1.1263951715931941, -0.9299308974783099, -0.20956189238965656, -1.3883475370797065