How do I get the part after the decimal point in Java?

Try this:

String numberD = String.valueOf(d);
numberD = numberD.substring(numberD.indexOf("."));

Now this numberD variable will have value of 15

Leave a Comment