Java Number Compare compareTo(double v1, double v2)

Here you can find the source of compareTo(double v1, double v2)

Description

compare To

License

Apache License

Declaration

public static int compareTo(double v1, double v2) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {

    public static int compareTo(double v1, double v2) {
        BigDecimal b1 = new BigDecimal(v1);
        BigDecimal b2 = new BigDecimal(v2);
        return b1.compareTo(b2);
    }//ww w.ja va 2 s  .  com
}

Related

  1. compare(final Number x, final Number y)
  2. compare(Object o1, Object o2)
  3. compareDoubleAgainstLong(double lhs, long rhs)
  4. compareDoublesWithTolerance(double aa, double bb, double tolerance)
  5. compareStringsAsNumbers(String s1, String s2, String op)
  6. compareTo(Object val1, Object val2)
  7. compareTo(Object value1, Object value2)
  8. compareTwoObject(Object o1, Object o2)
  9. compareValue(Object left, Object right)