Thursday, 22 August 2013

java multiplication between int and longs gives 0

java multiplication between int and longs gives 0

private static final int FIRST = 8;
private static final int SECOND = (4 * 1024 * 1024)/8;
private static final int THIRD = (4 * 1024 * 1024);
private static final long RESULT = FIRST *SECOND * THIRD;
Why is the product of the 3 coming out to be 0?

No comments:

Post a Comment