Here you can find the source of abs(double value)
public static int abs(double value)
//package com.java2s; //License from project: Open Source License public class Main { public static int abs(double value) { if (value == 0) return 0; if (value > 1) return 1; return -1; }//from w w w. j a v a 2s. co m }