Article View: borland.public.jbuilder.java.language
Article #8062Re: How do I round a number?
From: Mark Griffiths
Date: Mon, 23 Apr 2001 07:11
Date: Mon, 23 Apr 2001 07:11
15 lines
1418 bytes
1418 bytes
Use the static method 'Math.round()'. You will find the 'Math' class in the package 'java.lang'. -- Mark "Larry" <LarryOberly@msn.com> wrote in message news:3ae3b004$1_2@dnews... > > I would like two divide two numbers and then round up the > fractional part. For example if I divide two ints, 12/7 the > answer is 1.71 but Java will discard the .71 for an answer of > 1 what I would really like to happen is to have it round up to > 2. How do I do this? Thanks > >
Technical Details
Message-ID:
<3ae3d55b_1@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3ae3b004$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,250aeddcad7dba9c X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-04-23 00:30:04 PST From: "Mark Griffiths" <mark@chive.com> Newsgroups: borland.public.jbuilder.java.language References: <3ae3b004$1_2@dnews> Subject: Re: How do I round a number? Date: Mon, 23 Apr 2001 08:11:08 +0100 Lines: 17 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 217.32.160.227 Message-ID: <3ae3d55b_1@dnews> X-Trace: dnews 988009819 217.32.160.227 (23 Apr 2001 00:10:19 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!cyclone2.usenetserver.com!news-out.usenetserver.com!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews