Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pembulatan 1000
import java.math.RoundingMode;
import java.math.BigDecimal;
public class Pembulatan
public static int pembulatan1000( int nilai ){
BigDecimal _value = new BigDecimal( (double)nilai/1000);
_value= _value.setScale(0,RoundingMode.UP);
return _value.intValue()*1000;
public static void main(String []args){
int value = 1235;
System.out.println("Nilai Awal : "+value+" Menjadi : "+pembulatan1000(value));
int value2 = 900;
System.out.println("Nilai Awal : "+value2+" Menjadi : "+pembulatan1000(value2));
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.