Just run your source and it returns:
cos 90 : 1.8369701987210297E-16
sin 90 : 4.0
That's absolutely correct. The first value is nearly 0. The second is 4 as expected.
3 * cos(90°) = 3 * 0 = 0
Here you have to read the Math.toRadians() documentation which says:
Converts an angle measured in degrees to an approximately equivalent angle measured in radians. The conversion from degrees to radians is generally inexact.
Update: You can use for example the MathUtils.round() method from the Apache Commons repository and round the output to say 8 decimals, like this:
System.out.println("cos 90 : " + MathUtils.round(x, 8));
That will give you:
cos 90 : 0.0
sin 90 : 4.0