How to do pi in java

The code below show you how to obtain the PI value in Java.

double pi = Math.PI;
System.out.println(pi); // 3.1415 

if you don't whant to user Math Libary.

double pi = 3.14159265359;