반응형
import java.math.BigInteger;

public class Main {

	public static void main(String[] args) {

		BigInteger bigInt = new BigInteger("1");
		BigInteger bigTwo = new BigInteger("2");
		String str = "";

		int sum = 0;

		for (int i = 0; i < 1000; i++) {

			bigInt = bigInt.multiply(bigTwo);

		}

		str = bigInt.toString();

		for (int j = 0; j < str.length(); j++) {

			sum = sum + Integer.parseInt(String.valueOf(str.charAt(j)));

		}

		System.out.println(bigInt);
		System.out.println(sum);

	}

}
반응형

+ Recent posts