You want to format and parse decimal values.
Localized formatting of decimal values is easy in Java. It can be accomplished by passing the number into the getInstance method on the NumberFormat class. Then simply call format and parse.
To format and parse a decimal value for Arabic:
//Get a locale. We use Arabic without a country here.
ULocale arabic = new ULocale("ar");
//Get a decimal formatter instance
NumberFormat nf = NumberFormat.getInstance(arabic);
//format and output
String f = nf.format(123456.789);
System.out.println(f);
//Parse the value. We must handle the potential ParseException
try {
System.out.println(nf.parse("١٢٣٬٤٥٦٫٧٨٩"));
} catch (ParseException e) {
e.printStackTrace();
}
The output :
١٢٣٬٤٥٦٫٧٨٩
123456.789