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 9020269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:58:32+00:00 2026-06-16T04:58:32+00:00

Hi guys I need some help with calculating and displaying a ratio result. so

  • 0

Hi guys I need some help with calculating and displaying a ratio result.

so here is the sample code I am working on:

    double a = 11;
    double b = 2508;
    double total1;
    double total2;

    total1 = a / b;

    System.out.println(total1);

Now the result I get is 0.0043859649122807015 . However I only need the “0.004” the three decimal places, and to calculate the ratio I will need to round “0.004” in to 1 so how do I do that?

Phase2

    double a = 11;
    double b = 2508;
    double total1;
    double total2;

    total1 = a / b;

    System.out.println(total1);

    total2 = 1/total1; //1 is equal a rounded 0.004 then devided by 0.004

    System.out.println(total2);

But I had to manually put 1 to do the calculation. is there a way to store total 1 from the first calculation? total1 = a/b; . So I can call it back to do a “total2 = “A rounded 1 of 0.004″/total1;

Finally print the result out and is 250.

Little formula

11/2508 = 0.004

0.004 = 1 

1/0.004= 250

1:250

I have tried to use decimalformat on j2me but it does not support it

  • 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-16T04:58:33+00:00Added an answer on June 16, 2026 at 4:58 am

    You need a number formatter

    http://docs.oracle.com/javase/tutorial/java/data/numberformat.html

    System.out.format("%.3f%n", pi);     // -->  "3.142"
    

    Also just flipwhat your formula.

    2508/11 = 228

    so 1:228
    which is more accurate than 1:250

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

Sidebar

Related Questions

I am working on an iPad application and need some help from you guys.
Guys i need some help here , im getting this error here at the
I have one jQuery code and need some help from u guys to improve
Alright guys, Need some help! Im working with asp.net mvc3 razor (and am fairly
hi all i need some help from you guys.. well here's the description Guys
Hey guys! I need some help writing a code that creates an array in
hi guys i need some help here^^ i got a tag <html> <head> function
Hi guys I need some help here, to my bad thinking brain : I
hey guys i need help configuring some source code to basically when a error
Hi guys i need some help here i want to distribute 6 strings randomly

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.