473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Round decimal value in java

I have a decimal value 214332.04854. If i round it it will become as 214332 or 214332.0 in double or in float.I want to round & display 2 digits after that point.
Jan 18 '12 #1
2 1490
C CSR
144 100+
Start with this:

Expand|Select|Wrap|Line Numbers
  1. x = 24.12345
  2. y = Math.round(yy*100)/100;
  3.  
I'm suprizes no one replied to this yet.
Jan 18 '12 #2
C CSR
144 100+
Sorry. Too many y's. Correction:
Expand|Select|Wrap|Line Numbers
  1. x = 24.12345
  2. y = Math.round(x*100)/100;
  3.  
Jan 18 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Charles Kerekes | last post by:
Hello everyone, I am still learning C++, so I'm not sure what I'm trying to do is possible. Her is a simplified example: char Test = 'L'; cout << "Test Char as decimal: " << dec << Test <<...
2
by: Guoqi Zheng | last post by:
Dear Sir, I am trying to get one decimal value from DB. However, every time, I got an INT back instead of decimal. For example, if I have 4.75 in DB, I will get a 5 back. The followings are...
1
by: ven | last post by:
hello i`m makin a asp.net service with database connection where i have an insert with decimal value, when i run my function i get this error : There are fewer columns in the INSERT statement...
4
by: spebola | last post by:
I am using vb.net 2003 professional and I get the following results when using the round method: dim Amount as decimal = 180.255 Amount = Amount.Round(Amount, 2) Amount now contains 180.25. ...
3
by: Matt | last post by:
Anybody noticed that SQL Server rounds up if the value is half way between two rounded values, but C#'s Decimal.Round(Decimal,Int32) rounds to nearest even number? >From MSDN: "When d is exactly...
1
by: Microsoft News Group | last post by:
I am trying to make a column which is decimal format, convert nulls to a certain string such as "No Max". This is for a price range, and if they do not put a value in, a null value is put in...
7
by: Sukanta Bhattacharjee | last post by:
Hi, I am in big trouble for the last 10 days and not got any solution in the web. My problem is : I have a project in .NET 1.1 version, which I have transfered to .NET 2.0 version , almost all are...
1
by: poopsy | last post by:
how do i round a value to the nearest integer?
4
OuTCasT
by: OuTCasT | last post by:
I have been trying to save a decimal value into my sql database, what do you use , money, decimal, smallmoney, int ???
1
by: pankajprakash | last post by:
Hi, I have a decimal number. I need to convert this decimal value to exponential value. I have a vb.net code to convert from decimal to exponential value is Format(100000, #.0#E-##) . When I run this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.