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

  • Home
  • SEARCH
  • 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 8847073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:07:43+00:00 2026-06-14T12:07:43+00:00

All in the title.., I’m looking for a safe way to format all Double

  • 0

All in the title.., I’m looking for a safe way to format all Double in this manner, some other examples:

1000 ==> 1.000

1500 ==> 1.500

22000 ==> 22.000

1555005 ==> 1 555.005

I have looked in this link but not helped…

there is a safe way to do that ? THX in advance

  • 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-06-14T12:07:43+00:00Added an answer on June 14, 2026 at 12:07 pm

    You want to print your input number divided by a thousand, using a decimal dot and space as thousand separator. The safe way is to first convert to BigDecimal, scale by 10-3, then print it using DecimalFormat.

    final DecimalFormat f = new DecimalFormat("#,###.000");
    final DecimalFormatSymbols s = new DecimalFormatSymbols();
    s.setGroupingSeparator(' ');
    s.setDecimalSeparator('.');
    f.setDecimalFormatSymbols(s);
    final double input = 1_555_005;
    final BigDecimal x = new BigDecimal(input).scaleByPowerOfTen(-3);
    System.out.println(f.format(x));
    

    prints

    1 555.005
    

    Note that setting grouping/decimal separators explicitly like here is not the orthodox way to do this: normally you would let the Locale setting dictate the number format.

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

Sidebar

Related Questions

Some users like to write post title all in uppercase, which is completely annoying.
Title said it all. Some context: I got a search mechanism - search view,
The title explains all... I have this snippet of code in my application: String
Is all in the title, I do not understand the problem this time is
All is title :) I have this method : [[NetworkManager sharedInstance] getContentFromUrl:url withId:@json onResultBlock:^(NSData
Let's say my JSON is this: { achievement: [ { title: All Around Submitter,
I use html attribute title to set some hints like this: <a href... title=Go
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
Title says all. Sample code: ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object>
It's all in the title; super-simple I reckon, but it's so hard to search

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.