Java get the absolute value of a specified number

Java get the absolute value of a specified number

In java, The Math.abs() function returns the absolute value of a specified number.

refer to‮tual:‬turi.com
/**
 * @author lautturi.com
 * Java example: get the absolute value of a specified number
 */

import java.util.*;

public class Lautturi {
	
	public static void main(String[] args) {

	      Integer i = -6;
	      double d = -3.14;
	      float f = 1.414f;

	      System.out.println(Math.abs(i));
	      System.out.println(Math.abs(d));     
	      System.out.println(Math.abs(f));   
	      
	}

}

output:

6
3.14
1.414
Created Time:2017-08-30 05:29:13  Author:lautturi