A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
|
|
@ -0,0 +1,6 @@
|
|||
public class Printing{
|
||||
public static void main(String[] args){
|
||||
double printer = 7.125;
|
||||
System.out.printf("%09.3f",printer);//System.out.format works the same way
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
public class Format {
|
||||
public static void main(String[] args){
|
||||
NumberFormat numForm = new DecimalFormat();
|
||||
numForm.setMinimumIntegerDigits(9);
|
||||
//Maximum also available for Integer digits and Fraction digits
|
||||
numForm.setGroupingUsed(false);//stops it from inserting commas
|
||||
System.out.println(numForm.format(7.125));
|
||||
|
||||
//example of Fraction digit options
|
||||
numForm.setMinimumIntegerDigits(5);
|
||||
numForm.setMinimumFractionDigits(5);
|
||||
System.out.println(numForm.format(7.125));
|
||||
numForm.setMinimumFractionDigits(0);
|
||||
numForm.setMaximumFractionDigits(2);
|
||||
System.out.println(numForm.format(7.125));
|
||||
System.out.println(numForm.format(7.135));//rounds to even
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue