Skip to content

Instantly share code, notes, and snippets.

@itoz itoz/gist:1051110
Created Jun 28, 2011

Embed
What would you like to do?
JAVA 四捨五入
//四捨五入
BigDecimal origin = new BigDecimal(f);
BigDecimal res = origin.setScale(0,BigDecimal.ROUND_HALF_UP);
result = res.shortValue();
or
Math.round(f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.