Java Doc for NumberFormat.java in  » 6.0-JDK-Modules » j2me » com » sun » j2me » global » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
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 Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.j2me.global 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.j2me.global.NumberFormat

NumberFormat
public class NumberFormat (Code)
NumberFormat has features designed to make it possible to format numbers in any locale. It also supports different kinds of numbers, including integers (123), fixed-point numbers (123.4), percentages (12%), and currency amounts ($123). All of these can be localized.

To obtain a NumberFormat for a specific locale call one of NumberFormat's factory methods, such as:

  • getPercentageInstance(locale)
  • getIntegerInstance(locale)
  • getCurrencyInstance(locale)
  • getDecimalInstance(local)

Usage:

 NumberFormat f = NumberFormat.getCurrencyInstance(loc);
 StringBuffer sb = f.format(new Double(123.45), new StringBuffer());
 

Or eventualy it's possible to change number of decimals displayed

 NumberFormat f = NumberFormat.getCurrencyInstance(loc);
 f.setMaximumFractionDigits(2);
 StringBuffer sb = f.format(new Double(123.45559), new StringBuffer());
 


Field Summary
final public static  intCURRENCYSTYLE
     Currency style.
final public static  intINTEGERSTYLE
     Integer style.
final public static  charNONLOCALIZED_PERCENT_SIGN
     Non localized percent sign.
final public static  intNUMBERSTYLE
     General number.
final public static  intPERCENTSTYLE
     Percent style.
final public static  charUNICODE_INFINITY
     Unicode INFINITY character.

Constructor Summary
public  NumberFormat(int style, NumberFormatSymbols symbols)
     Create NumberFormat with given number pattern and set of locale numeric symbols.

Method Summary
public  Stringformat(long value)
     Method formats long.
public  Stringformat(double value)
     Method formats double.
public  Stringformat(int value)
     Method formats integer.
public  Stringformat(float value)
     Method formats float.
protected  Stringformat(Object o)
     Does formatting.
public  StringgetCurrencySymbolForCode(String currencyCode)
     Lookup table of supported currencies for appropriate symbol.
Parameters:
  currencyCode - code ISO 4217.
public  intgetMaximumFractionDigits()
     How many decimals is used to display number.
public  intgetMinimumFractionDigits()
     Get minimum of decimals used to display number.
public  intgetMinimumIntegerDigits()
     Gets minimum integer digits.
public  intgetMultiplier()
     Gets actual multilier used by this locale for this number style.
public  StringsetCurrencySymbol(String symbol)
     Sets currency symbol.
public  voidsetGroupingUsed(boolean used)
     Sets if grouping is used.
public  voidsetMaximumFractionDigits(int count)
     Set maximal number of decimals to be displayed.
public  voidsetMinimumFractionDigits(int count)
     Sets minimum number of decimals to be displayed.
public  voidsetMinimumIntegerDigits(int count)
     Sets minimum integer digits.
public  voidsetMultiplier(int multiplier)
     Sets multiplier to different value than symbols for this locale do.

Field Detail
CURRENCYSTYLE
final public static int CURRENCYSTYLE(Code)
Currency style.



INTEGERSTYLE
final public static int INTEGERSTYLE(Code)
Integer style.



NONLOCALIZED_PERCENT_SIGN
final public static char NONLOCALIZED_PERCENT_SIGN(Code)
Non localized percent sign.



NUMBERSTYLE
final public static int NUMBERSTYLE(Code)
General number.



PERCENTSTYLE
final public static int PERCENTSTYLE(Code)
Percent style.



UNICODE_INFINITY
final public static char UNICODE_INFINITY(Code)
Unicode INFINITY character.




Constructor Detail
NumberFormat
public NumberFormat(int style, NumberFormatSymbols symbols)(Code)
Create NumberFormat with given number pattern and set of locale numeric symbols.
Parameters:
  style - the style of NumberFormat
Parameters:
  symbols - NumberFormatSymbols identifying numbers formatting forgiven locale.




Method Detail
format
public String format(long value)(Code)
Method formats long.
Parameters:
  value - long number to format formatted long number



format
public String format(double value)(Code)
Method formats double.
Parameters:
  value - double value to format formatted double number



format
public String format(int value)(Code)
Method formats integer.
Parameters:
  value - integer value to format formatted integer number



format
public String format(float value)(Code)
Method formats float.
Parameters:
  value - float value to format formatted float number



format
protected String format(Object o)(Code)
Does formatting. Result is appended to parameter StringBuffer appendTo.
Parameters:
  o - object to format buffer with appended formatted text



getCurrencySymbolForCode
public String getCurrencySymbolForCode(String currencyCode)(Code)
Lookup table of supported currencies for appropriate symbol.
Parameters:
  currencyCode - code ISO 4217. currency symbol or null if none was found.



getMaximumFractionDigits
public int getMaximumFractionDigits()(Code)
How many decimals is used to display number. maximum number of decimals or -1 if non-localizedformatting is used.
See Also:   NumberFormat.setMaximumFractionDigits



getMinimumFractionDigits
public int getMinimumFractionDigits()(Code)
Get minimum of decimals used to display number. minimum number of decimals or -1 if non-localizedformatting is used.
See Also:   NumberFormat.setMinimumFractionDigits



getMinimumIntegerDigits
public int getMinimumIntegerDigits()(Code)
Gets minimum integer digits. number minimum of integer digits
See Also:   NumberFormat.setMinimumIntegerDigits



getMultiplier
public int getMultiplier()(Code)
Gets actual multilier used by this locale for this number style. Usually (1 or 100). the multiplier
See Also:   NumberFormat.setMultiplier



setCurrencySymbol
public String setCurrencySymbol(String symbol)(Code)
Sets currency symbol.
Parameters:
  symbol - the currency symbol previously used currency symbol



setGroupingUsed
public void setGroupingUsed(boolean used)(Code)
Sets if grouping is used.
Parameters:
  used - true if grouping should be used



setMaximumFractionDigits
public void setMaximumFractionDigits(int count)(Code)
Set maximal number of decimals to be displayed.
Parameters:
  count - number of decimals to display
See Also:   NumberFormat.getMaximumFractionDigits



setMinimumFractionDigits
public void setMinimumFractionDigits(int count)(Code)
Sets minimum number of decimals to be displayed.
Parameters:
  count - minimum number of decimals to display
See Also:   NumberFormat.getMinimumFractionDigits



setMinimumIntegerDigits
public void setMinimumIntegerDigits(int count)(Code)
Sets minimum integer digits.
Parameters:
  count - the count of digits
See Also:   NumberFormat.getMinimumIntegerDigits



setMultiplier
public void setMultiplier(int multiplier)(Code)
Sets multiplier to different value than symbols for this locale do.
Parameters:
  multiplier - new value for multiplier;
See Also:   NumberFormat.getMultiplier



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.