How to split integer and decimal part in java

This is simple tutorials but frequently useful when you developing application in android and software in java.

                                 double d= 234.12413;
String text = Double.toString(Math.abs(d));
int integerPlaces = text.indexOf('.');
int decimalPlaces = text.length() - integerPlaces - 1;
System.out.println("----integerPlaces +integerPlaces+"===decimalPlaces=="+decimalPlaces); 
How to split integer and decimal part in java How to split integer and decimal part in java Reviewed by D Kshetri on 10:11 PM Rating: 5

No comments:

Powered by Blogger.