Taking the whole part of a double

Hi all,
I have a double value...
double res = (xIntValue/yIntValue);
But I only wnat to output the whole part of the result, e.g
res = 7 / 2 = 3.5
System.out.println(3)
I would appreciate any help.

Cast the double to int before outputtingNo, don't do this. It's a quite inappropriate use of
an int cast. It also breaks for numbers >
Integer.MAX_VALUE.
Use java.lang.Math.floor().
Sylvia.
double res = (xIntValue/yIntValue);Sorry, I assumed deviding two integers would create a third integer.

Similar Messages

  • Preparing my photo library for the beta Photos is taking the better part of a week. Is this normal?

    The process of "preparing" my photo library for the beta Photos is taking the better part of a week. Is this normal?  I have around 2000 photos the iPhoto library I am uploading.

    How are you preparing the library?  The only thing I would do to prepare for converting to Photos once it's released would be the following:
    1 - launch iPhoto with the Command+Option keys held down to open the First Aid window. Be sure to follow the circled recommendation in the screenshot.
    2 - run Option #1, Repair Permissions.
    3 - run Option #4, Rebuild Database.
    Do this just prior to launching Photos for the first time.

  • Help! My phone is not taking the whole screen! (edge around the screen)

    I ve only been using my phone for less than a week. Today my phone was frozen so I hold down the home and the power button to do a reset. However, the apple logo appears and it took forever to get in the home menu so I hold down the buttons to reset the phone once again. The phone did get in the home screen after the second reboot but after that the size of the screen got smaller (Not taking the full screen) I turned off my phone and while I was under the sun i noticed that there is an edge around the screen! It is so noticable even I turned off the phone. So I used a full restore on my phone and now the edge is still there! Can anyone please tell me if they have the same problem before and know how to fix it(Like resizing the screen)? Thanks!!

    Is it a thick border? or just a couple rows? Mine has that, and a lot of electronics have the same thing... they cut the size they need and only use the pixels they want/need to use.
    For example I had a Zune and a new Nano that had the same thing... My Blackberry, and work cell phone... same thing.
    If its a thick border, then yes call apple and get it replaced/repaired.
    Message was edited by: Kalison

  • How can I play the whole album, when I double click on the album it only plays the first track?

    How can I play all tracks on an album, when I double click on the album it only plays the first track?

    Make sure all the tracks are check-marked.

  • I need the decimal part of a double...

    ...but I can't find a 'method' in the api to do this. Is there one?
    I would rather avoid writing one myself.
    Also, how can I set the precision of a float? I glanced at BigInteger but it seems to be for output only.
    Thanks,
    Jeff

    what if I need to compare the thousands place ofthe
    decimal part?Then you can either do it arithmetically, similar to
    what itchyscratchy showed, or you can format it as a
    string and compare the third character to the left of
    the decimal.Oops. Fourth character.

  • How much will it cost me to replace the whole top screen of my macbook, including the part that pivots to open and close it?

    I'm not sure of what it's exactly called, but my whole screen (including the black part that attaches the screen to the keyboard) is in bad condition. My screen is cracked, and when I open my macbook, the hinge is loose and flops and does not stay in place. Does anybody know how much it would cost for a replacement? Would I be better off buying a new laptop?
    Thanks

    This is an international community.  Prices vary from country, state, city, etc. 
    You should call the repair shop of your choice and ask for an estimate.  Make sure the estimate includes taxes, labor costs, etc.
    Remember, no one can give you an exact figure until the repair techs physically examine & run diagnostics on your computer to confirm what is wrong w/it.

  • I am moving to the uk from oz and was wondering do i have to replace the whole power cable for my mac book 15inch pro....or can i just replace the actual plug in the wall part ..if i can what is this called as when i look on line it just comes up with the

    i am moving to the uk from oz and was wondering do i have to replace the whole power cable for my mac book 15inch pro....or can i just replace the actual plug in the wall part ..if i can what is this called as when i look on line it just comes up with the complete power unit...it seems odd that you have to buy the whole unit again...thanks.matthew

    All you need is a plug adaptor, if required. Apple sells an adapter kit:
    http://store.apple.com/us/product/MB974ZM/B?fnode=MTY1NDEwMQ&mco=MTA4NDE3MDQ

  • When ever I print my bank staement from the website it never prints the whole statement , only the part that is visible on the screen . I am using an imac G5 with OS 10.4 and have always had this one problem with Fire fox. Thanks

    I think it's the same for other websites as well. That is, that only the visible part of the monitor will print instead of the whole window. I am using the latest upgraded fire fox browser that a non intell I mac G5 can use which is 3.6.8 upgrades above this are not possible

    OK - to answer my own question, Apple recommend 8.2.1, but you can install 9.1.1 and it will run on a G3. Very slowly. Looks like this is the only option. Get it here: http://support.apple.com/kb/DL1036. You need OSX 10.4.11 or later though....

  • Two part question 1) what happens if you  sign into messages beta on os x lion 10.7.5 after it expired? does the whole application not work or just imessage? 2) does installing messages beta on os x lion 10.7.5  delete ichat?

    Two part question
    1) what happens if you  sign into messages beta on os x lion 10.7.5 after it expired? does the whole application not work or just imessage? can you stil use AIM, jabbar, google talk, or yahoo?  if you open messages beta does it immediately tell you that messages beta expired?
    2) does installing messages beta on os x lion 10.7.5  delete ichat or just transform ichat into messages beta giving the illusion that ichat is deleted?

    Hi,
    It was never completely clear whether it was just hidden or whether Apple ran a download page for iChat 6.
    As the Download for Messages Beta was separate and "Deleted" iChat it would seem it would be another download for iChat 6.
    iMessages will not function as it is only an Account type within Messages and iChat 6 does not have it.
    Therefore messages on the iPhone will not sync to the Mac. (until you get Mountain Lion and Messages in that OS X version).
    Mountain Lion and it's full version of Messages will not sync the iMessages that have happened in between the 14th December 2012  (end date of Messages beta) and the Install of Mountain Lion if you decide on that route.
    8:51 PM      Sunday; May 5, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.3)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • My iPhone 4S is only playing part of a song and then stops, sometimes plays whole song but for the most part it just stops randomly

    My iPhone 4S is only playing part of a song and then stops, sometimes plays whole song but for the most part it just stops randomly

    Now it's Wednesday (2 days since I originally posted) & my iPhone appears to have finally restored all my apps, but it still says it's restoring from iCloud backup.  If all my apps are restored, what else could it be restoring?  IS it actually restoring anything at this point, or is it still in 'glitch' mode???  I've tried turning it off & back on & it continues to say that it's restoring.

  • Since I updated my Mac with iOS 7 I continually have pages open that get pixelated, either the whole page of parts.What can I do to fix the problems?

    Since I updated my Mac with iOS 7 I continually have pages open that get pixelated, either the whole page of parts.What can I do to fix the problems?

    Hi Peter,
    The results:
    Hardware Information:
              MacBook Pro (15-inch, Mid 2010)
              MacBook Pro - model: MacBookPro6,2
              1 2.4 GHz Intel Core i5 CPU: 2 cores
              4 GB RAM
    Video Information:
              Intel HD Graphics - VRAM: 288 MB
              NVIDIA GeForce GT 330M - VRAM: 256 MB
    Audio Plug-ins:
              BluetoothAudioPlugIn: Version: 1.0
              AirPlay: Version: 1.9
              AppleAVBAudio: Version: 2.0.0
              iSightAudio: Version: 7.7.3
    System Software:
              OS X 10.9 (13A603) - Uptime: 0 days 0:3:27
    Disk Information:
              Hitachi HTS545032B9SA02 disk0 : (320.07 GB)
                        EFI (disk0s1) <not mounted>: 209.7 MB
                        Macintosh HD (disk0s2) /: 319.21 GB (121.43 GB free)
                        Recovery HD (disk0s3) <not mounted>: 650 MB
              MATSHITADVD-R   UJ-898 
    USB Information:
              Dell Dell USB Keyboard
              Apple Inc. Apple Internal Keyboard / Trackpad
              Apple Inc. BRCM2070 Hub
                        Apple Inc. Bluetooth USB Host Controller
              Apple Internal Memory Card Reader
              Microsoft Microsoft Wireless Optical Mouse® 1.00
              Apple Computer, Inc. IR Receiver
              Apple Inc. Built-in iSight
    FireWire Information:
    Thunderbolt Information:
    Kernel Extensions:
              com.Cycling74.driver.Soundflower          (1.5.1)
              com.sophos.kext.sav          (8.0.14)
    Problem System Launch Daemons:
    Problem System Launch Agents:
    Launch Daemons:
              [loaded] com.adobe.fpsaud.plist
              [loaded] com.sophos.autoupdate.plist
              [loaded] com.sophos.intercheck.plist
              [loaded] com.sophos.notification.plist
    Launch Agents:
              [loaded] com.sophos.uiserver.plist
    User Launch Agents:
              [loaded] com.google.keystone.agent.plist
              [loaded] com.plexapp.mediaserver.plist
              [loaded] com.zeobit.MacKeeper.Helper.plist
    User Login Items:
              Safari
              iTunesHelper
    3rd Party Preference Panes:
              Flash Player
              Flip4Mac WMV
              Perian
    Internet Plug-ins:
              Default Browser.plugin
              Flash Player.plugin
              FlashPlayer-10.6.plugin
              Flip4Mac WMV Plugin.plugin
              Google Earth Web Plug-in.plugin
              iPhotoPhotocast.plugin
              OfficeLiveBrowserPlugin.plugin
              QuickTime Plugin.plugin
              Silverlight.plugin
    User Internet Plug-ins:
    Bad Fonts:
              None
    Time Machine:
              Time Machine not configured!
    Top Processes by CPU:
                  13%          Microsoft Word
                  11%          InterCheck
                   4%          WindowServer
                   1%          Dock
                   1%          com.apple.WebKit.Networking
                   1%          sharingd
                   0%          Safari
                   0%          Microsoft Excel
                   0%          Plex Media Server
                   0%          mdworker
    Top Processes by Memory:
              197 MB             Microsoft Word
              139 MB             WindowServer
              123 MB             InterCheck
              82 MB              Preview
              82 MB              com.apple.IconServicesAgent
              78 MB              talagent
              74 MB              com.apple.WebKit.WebContent
              70 MB              Mail
              66 MB              Microsoft Excel
              49 MB              Messages
    Virtual Memory Statistics:
              1011 MB            Free RAM
              1.62 GB            Active RAM
              651 MB             Inactive RAM
              651 MB             Wired RAM
              311 MB             Page-ins
              0 B                Page-outs
    Regards
    Kym

  • Area of the parts != Area of the whole

    My tables are polygon datasets stored in NAD83 (SRID=8265) and I have noticed that the sum of area calculations of a subdivided polygon do not equal the area of the original polygon.
    I created a simple test case to confirm the results. I created a square polygon, 5 degrees by 5 degrees (-94,36, -89,36, -89,31, -94,31, -94,36), and the resulting area (in square miles) is 99455.7384. I then cut that polygon into 10 irregular pieces which, if they were unioned back together, would equal the original polygon exactly. If I calculate the area on these polygons and sum the area, the result is 99444.1878 (a difference of ~11.5 square miles). I have increased the precision of the area fields to rule out problems caused by rounding or truncation. Why does the sum of the area of the parts not equal the area of the whole? Is there any way to perform a more rigourous area calculation that will give me areas that equal each other? I was wondering about triangulating the polygons (sort of like a TIN structure) before doing the area calculations to reduce error caused by the irregularity of the polygons. A tringulation solution would be ok for smaller datasets, but I am working with datasets that have 4 million polygons, so triangulation would be a bit time-consuming. It is important for our reporting purposes that the area sums equal the original area.
    On a somewhat related topic, I have also noticed that if I intersect that same starting polygon from above (5 degrees by 5 degrees) with another polygon dataset that extends beyond the boundaries of this polygon, the northen and southern boundaries of the resulting 'intersected' dataset are curved northward, with the northern boundary extending a small bit beyond the original boundary. I get resulting polygons that have coordinate values greater than 36 in the y dimension (northern boundary of the original), and only two coordinates that are equal to 31 which are found at the southern corners of the original. I understand that this is caused by the use of 'great circles' to calculate the shortest distance between my two northern boundary points and between my two southern boundary points, so this is not a 'bug' because great circles are not the same as latitude parallels. Is there any way to force the sdo_intersection command to perform the intersecetion while treating the coordinates as 'cartesian' coordinates, so that none of the resulting coordinate values extend beyond the original boundaries of my dataset?
    Thanks in advance for any help or suggestions.
    John

    Hi John,
    It is very likely that the first part of your question is related to the information you understand from the second part of your question, which is that Oracle uses great circles to connect points in a geodetic coordinate system.
    -94,36 connecting to -89, 36 actually deviates from the 36 degree line of latitude by almost 3km at its greatest (2885.3 meters at coordinate -91.5,36). That distance is smallest near the actual vertices and gets larger and larger until the midpoint between the coordinates specified (hence 91.5,36).
    If you arbitrarily cut that polygon into several pieces, then depending on how you slice it you could get a polygon with greater or smaller area than the original (if you slice horizontally you will get an area larger than the original, if you slice vertically the area is smaller).
    So hopefully the above explains the first part of your question.
    The second part of your question relates to the ability of Oracle to densify coordinates to either eliminate or greatly reduce the "drift" of the data along a line of latitude.
    Starting in Oracle 10g, the ability to specify a a geodetic "rectangle" was added to spatial/locator). This is done by specifying just the lower left and upper right coordinates, and using an sdo_elem_info_array of (1,1003,3) where the interpretation of 3 means you are specifying a rectangle. So your polygon would be specified as
    sdo_geometry(2003,8265,null,sdo_elem_info_array(1,1003,3),sdo_ordinate_array(-94,31,-89,36))
    Internally, this signals Oracle to densify this geometry at 1 degree intervals along the lines of latitude, so the movement off of the latitude line is limited.
    How limited? The "drift" off the line of latitude is greatest at 45 degrees north and south (this makes sense if you think about it - there is no drift at the equator, which of course is a great circle itself, and there is no drift at the poles). So you can use spatial to calculate the greatest drift:
    select sdo_geom.sdo_distance(
    sdo_geometry(2002,8265,null,sdo_elem_info_array(1,2,1),sdo_ordinate_array(-91,45,-90,45)),
    sdo_geometry(2001,8265,sdo_point_type(-90.5,45,null),null,null),0.5)
    from dual;
    So at 45 degrees north latitude, when densifying automatically every degree, the greatest movement from the line of latitude is about 121.3 meters.
    If you need to follow the line of longitude more precisely, you can densify at greater precision. For instance, if you densify at 0.5 degree intervals your greatest drift is about 30 meters. If you densify at 0.1 degree intervals along the line of latitude your greatest difference is about 1.21 meters.
    You could write a function to automatically densify, being careful near the poles so you don't create invalid geometries.
    Hope this helps,
    Dan

  • I have adobe illustrator CS5. When I save a document as a pdf and open it again later to edit Adobe reader can't read the whole document because it only shows part of the document. It is very frustrating. How can I fix this?

    I have adobe illustrator CS5. When I save a document as a pdf and open it again later to edit Adobe reader can't read the whole document because it only shows part of the document. It is very frustrating. How can I fix this?

    keokipineapples schrieb:
    I do have all of my files I am working on located on an external drive. I plan to transfer them directly to the hard drive
    Transfer them to your harddisk immediately.
    External drives are not offiially supported and the source of errors of all kinds including complete loss of files.
    Illustrator support for networks and removable media

  • What tool can I insert in tool box to undo last stroke and return to where I previously left off, e.g., when I am writing an e=mail and part of the message is deleted--so I don't have to re-write the whole message again?

    what tool can I insert in tool box to undo last stroke and return to where I previously left off, e.g., when I am writing an e=mail and part of the message is deleted--so I don't have to re-write the whole message again?

    Firefox doesn't do email, it's a web browser.
    If you are using Firefox to access web mail, you need to seek support from your service provider or a forum for that service.
    If your problem is with Thunderbird, see this forum for support.
    [http://www.mozillamessaging.com/en-US/support/]
    or this one
    [http://forums.mozillazine.org/viewforum.php?f=39]

  • I have Elements 12. I can not use the "zoom burst effect". I the programe I can ad zoom burst and the picture gets blured as it should. But the moment I try to sharpen part og´f the picture the whole picture imidiatly gets sharp. What is wrong?

    I have Elements 12. I can not use the "zoom burst effect". In the programe I can ad zoom burst and the picture gets blured as it should. But the moment I try to sharpen part of the picture the whole picture imidiatly gets sharp. What is wrong?

    I have Elements 12. I can not use the "zoom burst effect". In the programe I can ad zoom burst and the picture gets blured as it should. But the moment I try to sharpen part of the picture the whole picture imidiatly gets sharp. What is wrong?

Maybe you are looking for