Here you can find the source of compareTo(Object value1, Object value2)
public static int compareTo(Object value1, Object value2)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static int compareTo(Object value1, Object value2) { return new BigDecimal(String.valueOf(value1)).compareTo(new BigDecimal(String.valueOf(value2))); }/* ww w.j a v a2s . c o m*/ }