Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Check if one double value equals to a specific value
     * @param obj
     * @param value
     * @return
     */
    public static boolean equalsTo(double obj, double value) {
        return equalsTo(obj, value, 6);
    }

    public static boolean equalsTo(double obj, double value, int precision) {
        return Math.abs(obj - value) <= Math.pow(0.1, precision);
    }
}