Requirement: Double type data interception operation retains two decimal places
Solution:
1 Java.text.DecimalFormat df =new java.text.DecimalFormat ("#.00");
2 Df.format (the number you want to format);
Can also be written as a sentence:
1 new Java.text.DecimalFormat ("#.00"). Format (the number you want to format);
Extension: Java.text Package: Provides classes and interfaces that work with text, dates, numbers, and messages in a way that is not related to natural language.
Java.text:
1st: Formatting dates, numbers and messages
2nd: Parsing, searching, and sorting strings
3rd: Iterate characters, words, statements and line breaks
The Group of class:
1st-group: The class of the iteration text
2nd-group: Classes for formatting and parsing
3rd-group: Class for collating strings
Class Structure:
Format base class----> DataFormat, NumberFormat, Messageformat three formats for scenarios----> under three categories under the sub-category, Eg:numberformat under: Choiceformat and De Cimalformat.
Format package java.text from double type data to data