VND currency format in Java?

public class JavaApplication15 {

public static void main(String[] args) {
double price = 20000000;
Locale locale = new Locale("vi", "VN");
Currency currency = Currency.getInstance("VND");

DecimalFormatSymbols df = DecimalFormatSymbols.getInstance(locale);
df.setCurrency(currency);
NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
numberFormat.setCurrency(currency);
System.out.println("Formatted currency: " + numberFormat.format(price));

// System.out.println("CURRENCY SYMBOL = " + df.getCurrencySymbol());
// System.out.println("DECIMAL SEPARATOR = " + df.getDecimalSeparator());
// System.out.println("GROUP SEPARATOR = " + df.getGroupingSeparator());
// System.out.println("CURRENCY CODE = " + df.getInternationalCurrencySymbol());
// System.out.println("DECIMAL PLACE = " + numberFormat.getMaximumFractionDigits());
// String sLP = ((DecimalFormat) numberFormat).toLocalizedPattern();
}
}

One Button Has Multiple State

When you use a button with Two states, you just simply use a variable as boolean type (True/False).

But when you need a button with multiple states, How to do this?

That’s very simple by using the following statement:

 

<br />int state = 0

yourClickEvent(){
state = (state + 1) % numberOfStateYouWant
}

 

an Example when  numberOfStateYouWant = 3

drrg

 

Cheers.

Huy Nguyen