I was just wondering how to read say the first digit from a double for example if my double is 2400....read the 2 and use that and read the 4 and use that seperatly Is this even possible? Its for doing the colour code for resistors if anyone has any other ideas Thanks Justin
posted 12 years ago
You could use Double.toString(yourDouble) and extract numeric characters with String.subString(). Then convert your numeric characters back to a numeric primitive type.
Otherwise you will have to play around dividing by powers of 10 and taking remainders on division by 10.