Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3353740
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:11:16+00:00 2026-05-18T02:11:16+00:00

http://www.exampledepot.com/egs/java.text/FormatNum.html i have number 1.23 and i want to format it to 1,23. But

  • 0

http://www.exampledepot.com/egs/java.text/FormatNum.html

i have number 1.23 and i want to format it to 1,23. But if i have just 1 then i do not want format it to 1,00.

With ##,##0.00 i format 1.23 to 1,23 and 1 to 1,00. How can i format 1.23 to 1,23 and 1 to 1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:11:17+00:00Added an answer on May 18, 2026 at 2:11 am

    Try this pattern instead: ##,###.##

    DecimalFormat df = new DecimalFormat("##,###.##");
    System.out.println(df.format(1.00));
    System.out.println(df.format(1.23));
    

    prints:

    1
    1.23
    

    The 0 in the pattern shows zeros as “0”, while # shows zeros as absent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to describe an image through HTML tag as follow : http://www.exampledepot.com/egs/javax.swing/checkbox_AddIcon.html If
http://www.html5canvastutorials.com/webgl/html5-canvas-webgl-plane-with-three-js/ In this example its just a rotating plane. I'm an html 5 beginner
some of you may know the Java Almanac : http://www.exampledepot.com/ where a lot of
http://www.docjar.com/html/api/org/apache/catalina/realm/JDBCRealm.java.html To use this JDBCRealm we need two tables, user and user_role. user table
http://www.stellarwebsolutions.com/en/articles.php I just got the .pem to work with paypal but I cannot find
http://www.elasticsearch.org/guide/reference/index-modules/analysis/standard-analyzer.html I have to use standard analyzer during indexing with custom stopwords . How
http://www.bloomberg.com/markets/ has several figures that I would like to display on my html page.
http://www.koolfree.com/ImageUpload/uploads/1340729929.jpg (Table Image) Hello, I have linked to an Image (because stackoverflow was not
http://www.sitepoint.com/build-to-do-list-30-minutes/ So I was doing this (http://www.sitepoint.com/build-to-do-list-30-minutes/) tutorial and everyting went OK. but now
http://www.leandrovieira.com/projects/jquery/lightbox/ sample so i have get images in while loop here is my code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.