/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System.
out.
println("Rounded: " + round
(2.655d,
2)); // -> 2.65 System.
out.
println("Rounded: " + round
(1.655d,
2)); // -> 1.66 }
{
System.
out.
println("Before round: " + bigDecimal.
toPlainString()); bigDecimal = bigDecimal.setScale(15, RoundingMode.HALF_UP);
System.
out.
println("Hack round: " + bigDecimal.
toPlainString()); bigDecimal = bigDecimal.setScale(precise, RoundingMode.HALF_UP);
System.
out.
println("After round: " + bigDecimal.
toPlainString()); return bigDecimal.doubleValue();
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLm1hdGguKjsKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJU3lzdGVtLm91dC5wcmludGxuKCJSb3VuZGVkOiAiICsgcm91bmQoMi42NTVkLDIpKTsgLy8gLT4gMi42NQoJCVN5c3RlbS5vdXQucHJpbnRsbigiUm91bmRlZDogIiArIHJvdW5kKDEuNjU1ZCwyKSk7IC8vIC0+IDEuNjYKCX0KCQoJc3RhdGljIERvdWJsZSByb3VuZChEb3VibGUgZCwgaW50IHByZWNpc2UpCgl7CgkJCgkgICAgQmlnRGVjaW1hbCBiaWdEZWNpbWFsID0gbmV3IEJpZ0RlY2ltYWwoZCk7CgkgICAgU3lzdGVtLm91dC5wcmludGxuKCJCZWZvcmU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