Answers for "how to add decimals to integers java"

13

how to set 2 decimal places in java

DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(2);
System.out.println(df.format(decimalNumber));
Posted by: Guest on August-05-2020
1

how to convert a number into a decimal number in java

public class StringNumberToDecimal {

	public static void main(String[] args) {
		String string = "10";
		float decimalValue = Float.parseFloat(string);
		System.out.println(decimalValue);

	}
}
Posted by: Guest on December-15-2021

Code answers related to "how to add decimals to integers java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language