Converting double to integer in Java

double pi = 3.1415926535;
int intValue = (int)pi;
//intValue is 3