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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:34:48+00:00 2026-06-05T05:34:48+00:00

I am looking for a Java function that rounds up or down, but normally,

  • 0

I am looking for a Java function that rounds up or down, but normally, like 3.2 to 3, and 3.6 to 4. There are a bunch of answers, but all of them either rounding up exclusively or rounding down exclusively. If there is not one then I guess I will have to create it, but just wanted to see if anyone else has ever wanted the same and found one. Thanks 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-05T05:34:50+00:00Added an answer on June 5, 2026 at 5:34 am

    Math.round():

    public static int round(float a)

    Returns the closest int to the argument. The result is rounded to an integer by adding 1/2, taking the floor of the result, and casting
    the result to type int. In other words, the result is equal to the
    value of the expression:

    (int)Math.floor(a + 0.5f)

    Parameters:

    • a – a floating-point value to be rounded to an integer.

    Returns:

    the value of the argument rounded to the nearest int value.

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

Sidebar

Related Questions

I'm looking for a Java function to generate/verify password hashes that were encoded in
I am looking to create a function in Java that will take in two
I'm looking for Java rules engine options that will allow me to use the
I'm looking for java code (or a library) that calculates the earth mover's distance
I'm looking for a Java library that will can take a Image (PNG) and
I'm looking for a string indexof function from the std namespace that returns an
What is the opposite of the Math.tan(double x) function of java? I know that
I'm looking for an Erlang library function that will return the index of a
I'm looking for a Java library that is capable of performing spatial calculations on
I'm looking for a RegEx pattern to use in a rereplace() function that will

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.