자바에서 BigInteger는 어떻게 쓰나요?
integer
java
BigInteger sum = BigInteger.valueOf(0);
for(int i = 2; i < 5000; i++) {
if (isPrim(i)) {
sum.add(BigInteger.valueOf(i));
}
}
이렇게 써봤는데요. sum의 값이 항상 0이나옵니다. 뭐가 잘못된 건가요?
-
2016년 02월 23일에 작성됨
출처 : https://stackoverflow.com/questions/1783912/java-how-to-use-biginteger 이 질문은 저작자표시-동일조건변경허락(https://creativecommons.org/licenses/by-sa/3.0/deed.ko) 라이센스로 이용할 수 있습니다. 윤동길 2018.3.30 15:30