Created
June 16, 2015 11:32
-
-
Save ihcomega56/5b2d9f4a70859d4f3ba8 to your computer and use it in GitHub Desktop.
Java女子部勉強会201506〜BigDecimal#round()のふしぎ〜
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56789 は、3桁以上あるかな?( ・ὢ・ ) | |
1 は、3桁以上あるかな?( ・ὢ・ ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigDecimal; | |
import java.math.BigInteger; | |
/** | |
* Created by ihcomega56 on 2015/06/16. | |
*/ | |
public class RoundSample { | |
public static void main(String... args) { | |
BigDecimal 丸まるくん = new BigDecimal("56.789"); | |
BigDecimal 何も翁さん = new BigDecimal("0.0001"); | |
BigInteger 丸まるくんの丸め対象 = 丸まるくん.unscaledValue(); | |
BigInteger 何も翁さんの丸め対象 = 何も翁さん.unscaledValue(); | |
System.out.println(String.valueOf(丸まるくんの丸め対象) + "\tは、3桁以上あるかな?( ・ὢ・ )"); | |
System.out.println(String.valueOf(何も翁さんの丸め対象) + "\t\tは、3桁以上あるかな?( ・ὢ・ )"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment