hi,
I have a little problem in my project that I came-up with this morning (programming a simulation of a 24h-pizza-dispencer)

I need to count the decimals after the comma of a double
how do I have to write this?

ex.:
12.12 -(outcome)-> 2 decimals
12.123 -(outcome)-> 3 decimals

(the double is a price, entered in EUR ... and I want to catch that possible error)

much thx for your help!

---------------------------------
this is what I already tried-out (although inventive, I understand why it doesn't work :cool: )

temp=Double.parseDouble(prijsT[lade].getText());
							for(decimalen=0;temp%temp==0;decimalen++)
							{
								temp=temp*10;
								if(decimalen>=2)
								{
									JOptionPane.showMessageDialog(null,"De Prijs kan maximaal bestaan uit 2 decimalen! ","opgelet",JOptionPane.WARNING_MESSAGE);
								}
							}
						}

an other possibility is to convert the double to a string and
drop everything in front of the comma.. but I shouldn't know
how to do this

I drove to a couple of friends of mine and they said I'd had to ask it on an internet forum to get (quick) help... ;)