import java.math.BigInteger; public class prob16 { public static void main(String args[]) { BigInteger prod = new BigInteger("2"); int sum = 0; prod = prod.pow(1000); while (prod.doubleValue() > 0.5) { BigInteger m = prod.mod(new BigInteger("" + 10)); sum += m.intValue(); prod = prod.divide(new BigInteger("" + 10)); } System.out.println("Sum = " + sum); } }