I’m trying to round the number down despite the value after the decimal point. The purpose is then to subtract the rounded number from the full number to isolate the decimals as a new value.
DecimalFormat decfom = new DecimalFormat("#.##");
String splitter1 = decfom.format(newdecihole);
DecimalFormat df = new DecimalFormat("##.");
String splitter2 = df.format(newdecihole);
double split1 = Double.parseDouble(splitter1);
double split2 = Double.parseDouble(splitter2);
double splitdeci = split1 - split2;
double finfracti = splitdeci * 8;
What im trying to do is turn the result into whole numbers and 8ths. Everything ive tried works fine until I have a result that rounds up instead of down (which then gives splitdeci a negative value).
Ive tried making split 2 an int but it just rounds it up
Are you looking for
?
http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#floor(double)