{"id":26980,"date":"2021-05-07T23:10:06","date_gmt":"2021-05-08T03:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/numformat-java-formats-real-numbers-with-decimalformat-programming-code-examples-java-j2ee-j2me-basic-java\/"},"modified":"2021-05-07T23:10:06","modified_gmt":"2021-05-08T03:10:06","slug":"numformat-java-formats-real-numbers-with-decimalformat-programming-code-examples-java-j2ee-j2me-basic-java","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26980","title":{"rendered":"NumFormat.java Formats real numbers with DecimalFormat. #Programming Code Examples #Java\/J2EE\/J2ME #Basic Java"},"content":{"rendered":"<pre>\nimport java.text.*;\n\n\/** Formatting real numbers with DecimalFormat.\n *\n *  Taken from Core Web Programming from\n *  Prentice Hall and Sun Microsystems Press,\n *  .\n *  &copy; 2001 Marty Hall and Larry Brown;\n *  may be freely used or adapted.\n *\/\n\npublic class NumFormat {\n  public static void main (String[] args) {\n    DecimalFormat science = new DecimalFormat(&quot;0.000E0&quot;);\n    DecimalFormat plain = new DecimalFormat(&quot;0.0000&quot;);\n\n    for(double d=100.0; d&lt;140.0; d*=1.10) {\n      System.out.println(&quot;Scientific: &quot; + science.format(d) +\n                         &quot; and Plain: &quot; + plain.format(d));\n    }\n  }\n}\n<\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10224<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Basic Java<br \/>Tags:Java\/J2EE\/J2MEBasic Java<br \/> Post Data:2017-01-02 16:04:23<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>import java.text.*; \/** Formatting real numbers with DecimalFormat. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * &copy; 2001 Marty Hall and Larry Brown; * may be freely used or adapted. *\/ public class NumFormat { public static void main (String[] args) { DecimalFormat science = &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26980\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1917],"tags":[],"class_list":["post-26980","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":26517,"url":"http:\/\/bangla.sitestree.com\/?p=26517","url_meta":{"origin":26980,"position":0},"title":"HelloWorld.java  Simple servlet that generates plain text. #Programming Code Examples #Java\/J2EE\/J2ME #Servlet","author":"Author-Check- Article-or-Video","date":"April 27, 2021","format":false,"excerpt":"HelloWorld.java Simple servlet that generates plain text. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; \/** Very simplistic servlet that generates plain text. * * Taken from Core Web Programming Java 2 Edition * from Prentice Hall and Sun Microsystems Press, * . * May be freely used or adapted. *\/ public\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26956,"url":"http:\/\/bangla.sitestree.com\/?p=26956","url_meta":{"origin":26980,"position":1},"title":"Factorial.java Computes an exact factorial, n!, using a BigInteger #Programming Code Examples #Java\/J2EE\/J2ME #Basic Java","author":"Author-Check- Article-or-Video","date":"May 6, 2021","format":false,"excerpt":"import java.math.BigInteger; \/** Computes an exact factorial, using a BigInteger. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * \u00a9 2001 Marty Hall and Larry Brown; * may be freely used or adapted. *\/ public class Factorial { public static void\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26986,"url":"http:\/\/bangla.sitestree.com\/?p=26986","url_meta":{"origin":26980,"position":2},"title":"Basic Hello World application #Programming Code Examples #Java\/J2EE\/J2ME #Basic Java","author":"Author-Check- Article-or-Video","date":"May 7, 2021","format":false,"excerpt":"******************* HelloWorld.java Basic Hello World application. ******************* *\/ public class HelloWorld { public static void main(String[] args) { System.out.println(\"Hello, world.\"); } } \/* Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10397 Categories:Programming Code Examples, Java\/J2EE\/J2ME, Basic JavaTags:Java\/J2EE\/J2MEBasic Java Post Data:2017-01-02 16:04:39 Shop Online: https:\/\/www.ShopForSoul.com\/ (Big\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26954,"url":"http:\/\/bangla.sitestree.com\/?p=26954","url_meta":{"origin":26980,"position":3},"title":"ExecTest.java illustrates use of the Exec class. #Programming Code Examples #Java\/J2EE\/J2ME #Basic Java","author":"Author-Check- Article-or-Video","date":"May 6, 2021","format":false,"excerpt":"\/** A test of the Exec class. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * \u00a9 2001 Marty Hall and Larry Brown; * may be freely used or adapted. *\/ public class ExecTest { public static void main(String[] args) {\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27119,"url":"http:\/\/bangla.sitestree.com\/?p=27119","url_meta":{"origin":26980,"position":4},"title":"DebugTag.java Custom tag that optionally makes use of a tag body #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 11, 2021","format":false,"excerpt":"DebugTag.java Custom tag that optionally makes use of a tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.servlet.*; \/** A tag that includes the body content only if * the \"debug\" request parameter is set. * <P> * Taken from Core Web Programming Java 2 Edition *\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27148,"url":"http:\/\/bangla.sitestree.com\/?p=27148","url_meta":{"origin":26980,"position":5},"title":"Basic template for a Java applet #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 12, 2021","format":false,"excerpt":"AppletTemplate.java >>>>>>>>>>>>>>>>>>>> import java.applet.Applet; import java.awt.*; ******************** public class AppletTemplate extends Applet { \/\/ Variable declarations. public void init() { \/\/ Variable initializations, image loading, etc. } public void paint(Graphics g) { \/\/ Drawing operations. } } >>>>>>>>>>>>>>>>>>>>> Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From:\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26980"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26980\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26980"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}