Dependencies
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>3.6.1</version>
</dependency>
using common maths stats classes
double[] readList = new double[]{2.0,4.0};
DescriptiveStatistics statistics = new DescriptiveStatistics(readList);
Double max = statistics.getMax();