BigDecimal: how to  keep 2 fraction digits, round up.

Hi,
To calculate money amount, we need to have 2 fraction digits.
For example,
8888.567 --> 8888.57
99998888.865 ---> 99998888.87
0.982 --> 0.98
for method round(MathContext), the mathContext specifies total number of digits, not fraction digits.
The workaround we have to use:
amount.divide(new BigDecimal("1"), 2, RoundingMode.HALF_UP);
what is the right way to achieve 2 fraction digits/half-UP?
Thanks for help.
Dave

When handling money you are better off not using decimals. You can either create your own Money class which has 2 variables: dollars and cents. Or use ints for all calculations and then simply divide by 100 when you want to display. So one dollar fifty is int of 150 and not double of 1.5.

Similar Messages

  • How to keep the digital audio ouptut alive?

    I'm connecting my MBP audio via the optical digital audio connection and the digital stream disconnects after a short time (30 seconds? I haven't timed it.) whenever there's no audio coming out of the MBP: the optical actually stops transmitting (the LED goes dead).
    When it disconnects, my audio system tells me there's no signal and whenever an audio event occurs, it wakes up and inevitably the top of the audio signal is missing, as there's not enough time for the receiver to "wake up" before the audio event happens. I've actually tested this on two systems and it does the same thing.
    So, is there any way to keep the digital output alive, even if silent? I'm running powered with settings on "Performance" so there's no power-related reason for the digital audio to turn off. I haven't been able to find any other system settings that could help. Thanks for any pointers.

    Hello,
    I out a page before the page which takes long to load with the following xhtml tag:
        <xhtmlb:protectDoubleSubmit active = "true"
                                    timer  = "2500"
                                    text   = "<img src='/sap/public/bc/ur/Design2002/themes/sap_tradeshow/common/loading/loading_ani.gif'>"
                                    title  = "De werklijst wordt geladen..." />
    But the page is not kept alive. What does the parameter timer? Must it be set to 0?
    With regards,
    Frank

  • How to control fraction digits on inputfields-Jdev 11.1.1.6

    Hi,   I have a scenario like restrict the user to enter fraction digits 20 or lessthan 20 and integer digits are 5 or lessthan 5 for input text field.Even if user enter more than 20,it should not allow the user to enter digits after that 20digits. The data type is oracle.jbo.domain.Number with precision is (25,20). In jsff i have given like below:                             JDev Version:11.1.1.6.0 Example: precision(25,20) Valid: 1.23 111.23456 12345.12345678901234567890 12.12345678901234567890 Invalid: 12.1234567890123456789012 111111.62 Please provide any alternate solution. Thanks

    Take a look a this article by Yannick Ongena http://yonaweb.be/inter_portlet_communication_jsr_286_and_webcenter_11g_ps3

  • How to keep numbers from rounding up?

    I am currently using the script found on this page http://forums.adobe.com/message/4098624 to average numbers with blank fields.  It is working great, however, I need the answer to not round up.  I have the number property checked allowing two decimal places.  The answer will automatically round up, but I need the answer to not round up.  For example if the answer is 3.506, it will round up to 3.51, I need it to stay at 3.50.  I need the second number after the decimal (last number) to remain what it is regardless of what the third number is.  Is there a way to do this? Thank you for your help, I have very new to all of this and have very limited knowledge.

    You need to trim the value to just the number of  decimal places you want displayed. You can use the parseInt method or the Math.floor method of JavaScript.
    event.value = Math.floor(event.value * 100) / 100;

  • Macbook Pro - How to keep a low cycle count

    hey everyone,
    Basically I purchased a new macbook pro 11 days ago, and My current cycle count is also 11. I am eager to keep my cycle count down this time round as my last macbook's battery died at around the 700 mark (the laptop was around 15 months old at the time) which I am told was very high. The average apparently being around 300 for a computer that old.
    I have also read on other forums that people have managed to keep their cycle counts much much lower than 300 even for laptops over 15 months old.
    So to maintain my battery's life this time round I was wondering if anyone had any tips on how to keep the cycle count down this time round?
    Many thanks,
    Josh

    I should point out that the batteries that seem to survive the longest are those that get used--i.e. relatively high cycle counts. They are like muscles--use them or lose them. I tried keeping cycles down on my first battery and the results were that it made it only 11 months. Most of the "my battery failed..." posts we see here show a low cycle count.
    Also, you've posted a question about a new MBP in the forum for older ones made in Early 2008 and before. As the battery technology in your new MBP is different (and apparently better) and you have other hardware improvement made since 2008, you should use the forum for the current-generation MBPs here:
    http://discussions.apple.com/category.jspa?categoryID=251
    Not to worry. It's not your fault you found the wrong forum. "Original MacBook Pro" is a pretty non-intuitive label! About a dozen people a day with new MBPs end up here and sometimes get inappropriate advise if responders either don't notice of can't tell that the OP is asking about a newer Mac.

  • How to keep the macbook pro at operating temp

    What is the normal temperature and how to keep it there

    tmorphey,
    the normal temperature will vary according to the tasks that your MacBook Pro is executing. In my case, it’s typically in the low 40s °C, though it occasionally reaches triple digits °C (e.g. when it’s busy with source code compilation). Your MacBook Pro’s fan(s) should spin up as needed to keep the interior at an acceptable temperature. Be sure that you use your MacBook Pro in a location that doesn’t have airflow blocked, since that airflow is critical for the fans to do their job properly.

  • How to keep multiple function modules under one Web service

    Hi Experts,
    I have Three RFC function modules and i need to create one web service for these three RFC function modules. I know How to crearte a web service for one function module.
    please suggest me How to keep multiple function modules under one Web service.
    Thanks in advance
    Lakshminarayana

    Hi Lakshmi,
    The best way to do it is to assign all the three RFC Enabled FM's to one function group. Later on the top menu in Utilities you get an option to Create a Webservice from a Function Group.
    You can create one single Webservice using all the the 3 FM's.
    I hope this helps.
    Thanks,
    Manu

  • How to keep FI posting period (OB52) closed but keep CO posting periods (OK

    Hi SAP Guru's,
    how to keep FI posting period (OB52) closed but keep CO posting periods (OKP1) open.
    I.e. on Oct 21th the FI posting period 10 should be open but FI posting period 09 should be closed. But on Oct 21th the CO posting period 09 should be open.
    Thanks in Advance.
    RV

    You've already activeted. You can check in IMG-Financial Accounting Global Settings (New) ® Ledgers ® Real-Time Integration of Controlling with Financial Accounting
    Check this for more info http://help.sap.com/saphelp_dimp50/helpdata/en/22/c2cf4031288131e10000000a1550b0/content.htm

  • How to config Check Digits function module for Student Number Validation

    Hi SLCM Experts,
    In the SAP-SLCM, How to use check digits function module for validate student number.  Just only config it or need to customizing program.
    *Any idea to student number validation in SLCM?*
    Best Regards,
    Suvatchai K.

    Hi ,
    Can you expalin it further ?
    You configure the St. no in piq_matr . And set it  as external or internal no. range which suits your business .
    What is the validation you are looking for ?
    Regards
    Gajalakshmi

  • How to keep file name in print queue when printing crystal report

    We are using VB .Net 2003 + Crystal Report 2008 SP2 up to Fix Pack 2.6
    When the VB program spools crystal report files to print queue, the print queue only shows "Crystal Report" for each document.  How to keep the original file name?  In the past when we were using Crystal Report 11, the original file name can be shown in the print queue.
    Please help because it's so important for operation to see which report is failed in printing when reports are printed in batch.
    Thanks

    Hello,
    Set the PrintOption.JobTitle value for the print job. Here's C# code on how to:
                   System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
                CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptionsClass();
                CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions newOpts = new PrintOptionsClass();
                   pDoc.PrinterSettings.PrinterName = cboCurrentPrinters.Text;          
                   rasPROpts.PrinterName = cboCurrentPrinters.Text;               
                   rasPROpts.PaperSize = (CrPaperSizeEnum)
                        pDoc.PrinterSettings.PaperSizes[cboCurrentPaperSizes.SelectedIndex].Kind;
                // this sets the name of the print job
                rasPROpts.JobTitle = "MYPrintJob";
                   rptClientDoc.PrintOutputController.PrintReport(rasPROpts);
                   MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK,MessageBoxIcon.Information );
    Thank you
    Don

  • How to keep all text and formats the same on multiple computers?

    I'm creating a file in InDesign CS6 on my Windows computer. I keep everything on my flash drive. When I go to school, I bring my flash drive with me and open it up on the Mac computer, but then there are are compatibility issues. There seems to be missing fonts and formats but the school uses the same version of InDesign I do. Now I was told a lot of things of how to keep the fonts and formats the same (embed the links, package the files, outline the text, save as IDML). However, it is not clear to me what each of those options do, so I don't know when or why to use them. So I just want to make sure that when I bring in my file in next Monday, I won't have any missing fonts or formats. What would you suggest is the proper things to do to keep everything the same on multiple computers? And could you please explain why?

    If you want cross-paltform comaptibility limit the fonts to OpenType or Windows TrueType formats, both of which work on both Mac and PC. To avoid missing font warnings the fonts must either be installed on each computer, or they must be in a folder named Document Fonts in the same location as the .indd file they are to work with. Packaging the file will build taht folder for you.
    the rest of the stuff in your list won't help you. .idml would allow you to open on an older version, but does nothing for your situation. Embedding the links will keep you from having missing links, but so will packaging, and embedded links will make the file much larger and harder to work with.
    For goodness sake, don't even think about outlining the text. It stops being text when you do that and you can no longer edit it.
    And finally. do yourself a big favor and don't attempt to actually work on your file directly from the flash drive. Copy the whole package folder to the hard drive, work on it, then copy back. You don't want to know how many files are fatally damaged by write errors on flash drives.

  • How do I authorize digital editions on my laptop? I have authorized it on my desktop PC without a hassle but now I can't transfer downloaded books from my laptop to my ereader.

    How do I authorize digital editions on my laptop? I have authorized it on my desktop PC without a hassle but now I can't transfer downloaded books from my laptop to my ereader.

    Ererer1936 I would recommend posting your inquiry in the Adobe Digital Editions forum.

  • Does anyone know how to keep all songs in the same album when they say featuring someone?

    Each time I load a CD onto Itunes that has an artist who features another artist on that particular song, it puts it in my library as a separate CD even though it will have the same album listed.  For instance Lady Gaga's song just dance features Colby O'Donnis that song is in its own spot while the rest of the cd is together that one song is separate and I don't know how to keep them all together.  Someone help.

    Get the Informations for that song and have a look in the "Sorting" area if there is something different. The data inserted there is just for how iTunes will order the songs.
    If the Interpret in the general informations is "Lady Gaga" and in the sorting area is "Lady Gaga feat. xxxx" than you'll see Lady Gaga as the interpret but it's sort to a second entry "Lady Gaga feat. xxxx".

  • How to keep songs on iphone, work computer and home computer the same?

    How to keep songs on iphone, work computer and home computer the same?
    This seems like something everyone would want to do. I don't know why Apple won't give us a simple solution. They could even charge us for it. I would pay!
    Has anyone solved this? What is your solution?
    Thanks!
    [email protected]

    If you just want to be able to sync your devices to the same PC without having them get overwritten all the times, here is a free method
    http://cnettv.cnet.com/sync-your-ipod-two-computers/9742-1_53-50004835.html
    Basically, you put the same itunes database file on all the PCs. This fakes itunes into thinking it is always the same PC and the ipod is OK to sync with it. It will NOT keep your libraries truly synced, though. I've just resigned myself to always buying from one PC and manually transferring the content to other PCs I want it on.

  • How to create a digital signature in adobe reader

    how to create a digital signature in adobe reader?

    Adobe Reader Touch (Windows Store app with "modern" UI) does not support any types of signatures yet.
    Digital Signatures with certificates
    Electronic Signatures (that are legally enforceable)
    Signature annotations (hand-writing annotations which may not be secure and legally enforceable)
    Adobe Reader XI (traditional desktop app with classic UI) supports #1 and #3.
    Adobe EchoSign supports #2.
    Adobe Reader for iOS/Android supports #3.

Maybe you are looking for

  • Access image data

    Iam doing a project on remote desktop viewing.For this I need to access image data stored in the video memory.If anyone has any information regarding this please mail us. [email protected]

  • URGENT INFO NEEDED  - DVD's not burning on macbook - 4 brands now tried

    Hi. I've been trying to burn photos onto DVD's all week and I've now tried 4 different brands inc sony - my mac has a superdrive and is supposed to take -R, -RW, +R and +RW. I've tried all of these and they are either not being read/ ejected as not b

  • How to setup OWF and 2 OWB repositories in 1 database

    I have 2 OWB repositories in 1 database, 1 for development (OWBOWN_D schema) and 1 for testing (OWBOWN_T). In the same database I have a OWF repository (OWF_MGR schema). The objects in the development and test OWB repository have the same names, incl

  • Difficulty in figure out the DDL option parameter

    When i try to apply the below lines the local extract parameter the error throws DDL & DDLOPTIONS REPORT DDLOPTIONS ADDTRANDATA Error 2013-03-22 10:13:44 ERROR OGG-00288 Oracle GoldenGate Capture for Oracle, LSTGDC1C.prm: Unrecognized option in DDL s

  • Forecasting Models in Demand Planning.

    Hi experts, want to know in details and also to practice various forecasting models in Demand Planning, from beginning. please suggest. Regards Bhupendra