Here you can find the source of abs(int val)
public static int abs(int val)
//package com.java2s; //License from project: Apache License public class Main { public static int abs(int val) { if (val >= 0) return val; return val * -1; }//from w w w. j a v a 2 s . c o m public static long abs(long val) { if (val >= 0) return val; return val * -1; } }