Java Double.compareTo() is a method in the Java Double class that compares two Java double values. It returns a negative value if the calling value is less than the argument, zero if they are equal, and a positive value if the calling value is greater. Introduced in Java 2004 with Java 5, compareTo() is used for sorting, comparing values, and ordering double numbers in Java applications.
https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html