Skip to content

Instantly share code, notes, and snippets.

@ihcomega56
Created June 16, 2015 11:32
Show Gist options
  • Save ihcomega56/5b2d9f4a70859d4f3ba8 to your computer and use it in GitHub Desktop.
Save ihcomega56/5b2d9f4a70859d4f3ba8 to your computer and use it in GitHub Desktop.
Java女子部勉強会201506〜BigDecimal#round()のふしぎ〜
56789 は、3桁以上あるかな?( ・ὢ・ )
1 は、3桁以上あるかな?( ・ὢ・ )
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