The ; symbol is used to specify an alternate pattern for negative values : Decimal « Data Type « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Data Type » DecimalScreenshots 
The ; symbol is used to specify an alternate pattern for negative values
 

public class Main{
public static void main(String[] argvthrows Exception{

    NumberFormat formatter = new DecimalFormat("#;(#)");
    String s = formatter.format(-1234.567);         // (1235)
    sysout

}}

   
  
Related examples in the same category
1. Display the total amount of memory in the Java virtual machine.
2. Display the maximum amount of memory
3. Display the amount of free memory in the Java Virtual Machine.
4. Round number to fewer decimals
5. Display numbers with commas
6. Change the decimal separator is set to "."
7. Display numbers in scientific notation
8. Use java.text.DecimalFormat to format integer
9. new DecimalFormat("0.######E0")
10. Use new DecimalFormat("0.#####E0") to format double
11. new DecimalFormat("000000E0")
12. Display numbers with leading zeroes
13. Display a percentage
14. Display a currency value
15. new DecimalFormat(abc#)
16. DecimalFormat("00E00")
17. DecimalFormat("000E00")
18. DecimalFormat("0000000000E0")
19. new DecimalFormat("0.00")
20. new DecimalFormat("#.#")
21. new DecimalFormat("#.######") (1)
22. new DecimalFormat("#.000000")
23. new DecimalFormat(".######") (2)
24. new DecimalFormat("#,###,###") (grouping)
25. new DecimalFormat("##00")
26. Convert a number using the current Locale()
27. The 0 symbol shows a digit or 0 if no digit present
28. Use group separators and show trailing zeroes
29. Force minimum number of digits to left and right of decimal point
30. Set format to two decimal places: set Minimum Fraction Digits
31. Set format to two decimal places: set Maximum Fraction Digits
32. The . symbol indicates the decimal point
33. The , symbol is used to group numbers
34. The ' symbol is used to quote literal symbols
35. DecimalFormat("00.00E0")
36. The number of #'s to the left of the decimal point sets the multiple of the exponent.
37. DecimalFormat("##E0") (exponent must be multiple of 2)
38. DecimalFormat("###E0") (exponent must be multiple of 3)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.