StackOverflowError caused by conversion program

Hello all,
I'm a bit new to Java, so please bear with me if the answer to my problem is an obvious one.
I am trying to write a program to convert numbers (floating and negative, too) from the given base to base 10. As this is part of a larger project, what i have already written will no doubt appear as overkill, but the code in question can be found at http://rafb.net/paste/results/YDpaXH25.html (the relevant section is bounded by 5 lines of asterisk comments on top and bottom). In any case, though the current code has no syntax errors, a runtime error does occur when i try to call it like so;
// java code
public class BasemathInterface {
public static void main(String[] args) {
Basemath a = new Basemath();
a.convertBase(10, 23.4, false);
//end java code
a StackOverflowError:
Exception in thread "main" java.lang.StackOverflowError
Press any key to continue . . .
I suspect this has something to do with line 88, where the second "half" of floating-point numbers are handled, since I've heard StackOverflowErrors are often caused by infinite loops, though i'm not sure how the current code would set up such a loop. Any help would be appreciated.
Thanks in advance.

Hello again . . . I changed the method a bit so that a StackOverflowError doesn't happen, but unfortunately that's because two "possible loss of precision error"s (num1 = convertBase(base, num1, false); num2 = convertBase(base, num2, true)) prevent the program from compiling . . . any ideas on why these happen and/or how to fix it would be appreciated.
     public double convertBase(int base, double num, boolean lessone) {
          int negflag = 0;
          int x;
          boolean conflag;
          String convert = "";
          if (contains(Double.toString(num), ".")) {
               int dot = index(Double.toString(num), ".");
               int num1 = Integer.parseInt(Double.toString(num).substring(0, dot));
               int num2 = Integer.parseInt(Double.toString(num).substring(dot+1));
               num1 = convertBase(base, num1, false);
               num2 = convertBase(base, num2, true);
               dot = index(Double.toString(num), ".");
               num2 = Integer.parseInt(Double.toString(num).substring(dot));
               num = Double.parseDouble(Double.toString(num1) + "." + Double.toString(num2));
          else {
               String[] number =  new String[Double.toString(num).length()];
               int[] inumber = new int[Double.toString(num).length()];
               for (int i = 0; i < number.length; i++)
                    number[i] = Double.toString(num).substring(i-1, i);
               if (lessone == false){
                    x = 0;
               else {
                    x = -1;
                    reverse(number);
               reverse(number);
               for (int i = 0; i < number.length; i++) {
                    if (overten.containsKey(number)) {
                         conflag = true;
                         convert = number[i];
                         Integer ovr10 = (Integer)overten.get(number[i]);
                         number[i] = Integer.toString(ovr10.intValue());
                    else conflag = false;
                    if (number[i].equals("-")) {
                         negflag += 1;
                         remove(number, i);
                         continue;
                    else ;
                    if (Integer.parseInt(number[i]) < base) {
                         number[i] = Double.toString(Integer.parseInt(number[i]) * Math.pow(base, x));
                         if (!lessone)
                              x += 1;
                         else x -= 1;
                    else {
                         if (conflag) {
                              System.out.println("Numbers of Base " + base + " Cannot Have '" + convert + "' In Them.");
                         else System.out.println("Numbers of Base " + base + " Cannot Have " + number[i] + "'s In Them.");
               for (int i = 0; i < number.length; i++) {
                    if (!lessone)
                         inumber[i] = Integer.parseInt(number[i]);
                    //else inumber[i] = Double.parseDouble(number[i]);
               if (negflag % 2 != 0)
                    return -1 * sum(inumber);
               return sum(inumber);
          return 1;

Similar Messages

  • Appraisal Conversion Program

    while trying to appraise the business event, the following error is displayed:
       Appraisal Conversion
       Error in T77S0 SEMIN EVAPA or SEMIN EVAEV 
    can any help on this. also give some insight on "Appraisal Conversion Program"
    apt inputs are appreciated and rewarded.

    Have a look at OSS note 214834\
    Symptom
    The conversion of the appraisals is started and the system displays error message: Error in T77S0 SEMIN EVAEV and SEMIN EVAPA
    Cause and prerequisites
    As of Release 4.5B, appraisals must be converted in Training and Event Management. The report to be carried out (RHUMAPPR) must be started in each system (development system, Customizing system, production system ...). The Customizing generated by this report (appraisal model, forms of appraisal, scales, T77S0 entries) should preferably not be transported!
    The error message states that the two entries of table T77S0 'SEMIN' 'EVAEV' and 'SEMIN' 'EVAPA' were transported from another system.
    Solution
    Set the entries for SEMIN EVAPA and SEMIN EVAEV back to your orginal value again. Note that these values must have four digits before the conversion (for example, 0001, 0002, 9001 ...).
    After the conversion, the eight-character appraisal form is then displayed in this field.
    You may not be able to maintain the values because a check is being carried out on the appraisal form. In this case, use Transaction OOB1 to maintain a 'dummy' appraisal form, maintain the T77S0 values and delete the dummy appraisal form before starting the conversion again.
    Thanks,
    Puneet

  • Conversion program for the open sales orders

    Hi ,
         How to proceed for writing a conversion program for open sales order ??
    Please share if 've any document or idea.
    LSMW object: 0090, Method: 0000
    Business Object : BUS2032, Method : CREATEFROMDAT2,
    Message Type: SALESORDER_CREATEFROMDAT2
    Basic Type: SALESORDER_CREATEFROMDAT202
    Regards,
    Jyoti Shankar

    Dear Saso,
    I think, instead using Report: VA05/ VA05N; its better to use Report: VL10C
    In this report, you will get all the Sales Orders along with Materials - relevant for open delivery, along with Open Qty. and various other options can be selected from "Change Layout - (Ctrlt+F8)".
    Best Regards,
    Amit
    Note: Don't maintain any Field-Entry (while executing the Report: VL10N; in order to list all Sales Orders. But, if you want to list Sales Orders based upon some criterias, maintain the Field-entries, as reqd.

  • Windows 8 - Photoshop CS5.1 crashes upon startup. Error message: "Adobe Photoshop CS5.1 has stopped working.A problem caused by the program to stop working correctly. Windows will close the program and notify you if a solution is available."

    Hello!
    I've had the student version of the Adobe Creative Suite 5.5 Design Premium software for several years now.
    When I received my Windows 8 computer I installed the software with no issue.
    Last week when I tried opening Photoshop I get the following error: "Adobe Photoshop CS5.1 has stopped working.A problem caused by the program to stop working correctly. Windows will close the program and notify you if a solution is available."
    I deactivated and uninstalled the entire Creative Suite then reinstalled it. I am able to open the other programs, but still receive the same message for Photoshop.
    What can I do?

    I found the issue was with the Nik Filters I was using. The filters were messing with Photoshop's initializing. I uninstalled and reinstalled the filters and now Photoshop works like a charm.
    It appears this forum is dead?!
    Thankfully, I was able to troubleshoot on my own and figured out the problem...

  • BW Upgrade "Execute the conversion programs for the product master "

    Hi BW Gurus,
                        We are in the process of upgrading BW 3.5 to BW 7.0. We did not get any conversion error in BW Dev but in BWQ we got error in one of ABAP program. The error message in log is :-
    "Value '######' of characteristic 0TIME is not a number with 000006 spaces"
    and job pertaining to the program is canceled in SM37.
    My question is, are we suppose to run any conversion program before or after the upgrade?
    Warm Regards,
    Anil

    Hi  Chandu,
    I am also looking for the same if u have fond a bapi for any other program please forward the information.
    Thanks & Regards,
    Basheer

  • VA41 Conversion program using BAPI's.

    Hi Friends,
    Could u please tell to develop/create conversion program to transfer data using BAPI's by using trx VA41(CREATE CONTRACT), I have Contract Document number(ID).
    This is one time conversion.
    Please tell step by step.
    Thanks in advance.
    Points rewarded for ur kind assistance.
    regard. Vishnu

    Hi Vishnu,
    There is a standard BAPI called <b>BAPI_CONTRACT_CREATEFROMDATA</b> available for VA41. Use that BAPI for the conversion. Get back to me if you got any doubts.
    Reward if useful.
    Thanks
    Aneesh.

  • Conversion program generated with errors

    in lsmw idoc method at the step 11 convert data iam getting error as conversion program generated with errors can some body help me .i assigned port ,partnertype and partner number and activated inbound processing but still getting this error.somebody pls help me its urgent.

    Hi Mamidi,
    Go to the LSMW you have choosen and if it is Recording Method you are getting this error.
    Select Goto-->Recordings.
    Select the Recording you have choosen in the Edit Mode.
    Click on the Defaults All Button and save the recording.
    Now go to the option Convert Data and check .
    You will receive a message ..Conversion program successfully generated.
    Thanks,
    Sri

  • Having a problem converting a PDF file to Words with Adobe's conversion program.

    Having a problem converting a PDF file to Words with Adobe's conversion program.

    See https://forums.adobe.com/docs/DOC-2412
    If you need more help, please ask in https://forums.adobe.com/community/acrobatdotcom/

  • UTF8 encoding Issue in the conversion program

    Hi all,
    Our requirement is to get data from a file stored in application server and update the SAP database.
    The flat file has some special characters such as u2122, ® etc.
    In the conversion program, we are using the encoding format as UTF-8. This means it will only handle UTF-8 file ( byte order mark (BOM) 8).
    After running the conversion program, we came to know that the special character u2122 is getting replaced wtih #.
    And when we modified the format of flat file to UTF-8 instead of ANSI or UTF-16 or 32.
    We were able to get the trademark symbol in correct look in addition with other special characters.
    Since this involves a manual of processing modifying the flat file to UTF-8 format and then running the conversion program for getting all the special characters in good look, we are thinking to make this process "automatic" in the conversion program itself i.e. whatever the format of flat file may be, we would convert that file to UTF with BOM 8 format and then go ahead with the next updating processes.
    So, can anybody let me know if we can make this an automatic process?  Can we convert each non UTF-8 record read from flat file to UTF-8 record in the program itself by any means and then update that record in the database? Is there any FM for this? Or can we convert the flat file to UTF-8 file programmatically irrespective of the original file formats?
    Any inputs on this would be greatly appreciated.
    Thanks,
    Shamim

    Sham,
    Try with the class CL_BCS_CONVERT and the method STRING_TO_SOLIX.
    Regards,
    Kiran Bobbala

  • Is there a FREE WMA conversion program?

    Hi everyone, quick question: Is there a WMA to MP3 Conversion program out there that is FREE? I've searched and searched but everything is a demo with an activation fee. If you know of any, can you give me the name and/or link please? Thank you VERY MUCH in advance.

    crafylady
    Welcome to the HP Community Forum.
    You listed your complete Product Information as Dell.
    So, assuming you mean a Dell Printer, the answer is No.  Smiling.
    If you mean a Dell computer and an HP Printer, then the Answser is a resounding, "Maybe", "Probably".
    The answer depends on the Printer Model and the Dell Operating System.
    You can find HP Printer Software installation instructions and help below.  Included is an example of the Scan a Document or Photo function that is relevant for many of the versions of the Printer software.
    Install Full Feature Software – Printer
    The printer's Support Pages also include your User Guide, videos, and lots of How-to links to useful documents.  There is also, in most cases for most printer modesl, an extensive "Troubleshooting" section.
    Click the Kudos Thumbs-Up to say Thank You!
    And...Click Accept as Solution when my Answer provides a Fix or Workaround!
    I am pleased to provide assistance on behalf of HP. I do not work for HP. 
    Kind Regards,
    Dragon-Fur

  • BAPI or Conversion Program for Head Office/Branch functionality

    We are shifting our Vendors to Head Office/Branch functionality.  Our ordering vendor now becomes a Branch.  We need to transfer any open items left in the Ordering vendor account, and move them to the new Head Office account.
    Has somebody done this in their own company or client?  If yes, please advise your methodology, and if any BAPIs or conversion programs were used, please let us know.
    Thank you for your help.
    Core

    Hi
    Just Check the link below.
    http://help.sap.com/saphelp_45b/helpdata/en/5f/1faba54aee11d189740000e8322d00/frameset.htm
    Hope it helps.
    Regards
    Mohamed Mansoor

  • Conversion program to do movement type 202 and 309

    Hi everyone,
    I need to do a conversion program to upload current stock balance from 1 material to another material (Material to material transfer). This is because we have created a new material type, therefore i would need to move any current stock balance of 1 material (of a different material type) and create the material again in the new material type and transfer the current stock to it.
    Our consultant has decided upon using movement type 202 and 309 to do the goods movement required.
    Since MIGO could not be recorded, is there any other suggestion besides using ABAP program?
    Thanks in advance. Hope to get some feedback on this asap because this is urgent.

    Hi Bernard,
    You can check the direct input program RM07MMBL for goods movement.
    This is used in most of the cases to do a goods movement.
    Hope this helps
    Cheers
    VJ

  • Vendor Upload by conversion program

    HI Experts ,
    I am uploading vendor master data by conversion program , in that due to 1 field in Control data(customer - KUNNR ) I am unable to upload vendor.
    In this field when i give the customer number which is already referenced for another vendor , it gives a message that it is already referred to XXX vendor , though it is a warning message , it does not create vendor .But my session in SM30 shows success.
    But ultimate result is vendor does not get created.
    But when I give new customer or keeps blank, vendor gets created .
    please guide & advice on this problem. I need to enter data in this field .
    Thanks in advance

    HI
    thanks for your help.
    But this is happening not only in conversion program but also if i execute manually  FK01 , it does not save that vendor .
    Manual FK01 also not saving that vendor .
    What could be wrong ?
    Thanks in advance.
    Abhishek Govilkar

  • Would like to find out how a Pages document might be opened by a recipient that only has a PC with Windows and Microsoft Office.  Is there a conversion program?

    Hi!
    Would like to find out how a Pages document might be opened by a recipient that only has a PC with Windows and Microsoft Office.  Is there a conversion program?

    Making changes to PDF file: Apple Support Communities
    Have just noticed this in a thread today.   The link from Klaus1's post may allow you to use PDF and work on it.   I haven't tried it but it may give you some extra ammunition.

  • Data conversion program

    can u give idea about data conversion program for inventory management program stocks,which reads legacy extract file and the valuation master file from pc gets issue storage location valuation details and output a file with these details
    regards,
    phani

    Hi Phani,
    Make sure that the data from legacy system is stored in a TXT file in a specific format.
    In SAP, create a program to upload the file using FM GUI_UPLOAD. The structure of the internal table will be same as that of the file.
    Upload the data and update the necessary tables.
    Best regards,
    Prashant

Maybe you are looking for

  • SB Live reinstall probl

    Ok, here's my story: I recently had a hard dri've fail on me, so I had to reinstall Windows (2000) on a new one and basically start over. I have everything pretty much back to normal now, except for my SB Li've. When I first booted up, it acted like

  • Saved file will not show up when trying to attach file in mail

    Sometimes... and only sometimes.. when I make a new file and then go back to my email or browser to attach the file it will not show in the place I saved it. If I click to list view SOMETIMES. I check the folder I saved it in and it's there.... .. go

  • Printing with snow leopard

    Since updating to snow leopard my printing options disappeared. When I plug my HP Deskjet 4200 into the laptop it finds it and prints. But when I try and print via the time machine it can not find the printer, or give an error message saying the host

  • How to restore a library folder from Time Machine BU

    I had a problem synching my iPhone & MBP with iCloud and lost my iCal data. I have a Time Mach B/U but as you know, Mavericks hides all one's libraries. The iCal files are in a library folder. How do I get Mavericks to reveal my Libaries in the TM BU

  • Recent purchase playlist?

    Perhaps someone can shed some light on my situation.  I do not have a" recent purchase" playlist on my Itunes homepage.  I have a purchased playlist but it seems to me I once had recent purchased playlist also.  Am I mistaken?  If I'm not mistaken ho