I need a correction for this ...!!!!

i came up with a recusive method but it has some inefficiency .. if i create an object of type int ,say 1234567 it will work properly, but if the int was say 1000000 or 1000001 it will return 1,0 and 1,1 ,respectively ... and here is the code .. i need a correction
===========================================================
public class intComma
public static String putComma(int x)
String st = x+"" ;
int L = st.length() ;
if (L<= 3)
return st;
else
if (L%3 == 1)
return st.charAt(0)+","+putComma(Integer.parseInt(st.substring(1)));
else if (L%3 == 2)
return st.substring(0,2)+","+ putComma(Integer.parseInt(st.substring(2)));
else
return st.substring(0,3)+","+ putComma(Integer.parseInt(st.substring(3)));
public static void main(String[] args)
System.out.println(putComma(1234567));
System.out.println(putComma(1000000)); // here is the problem
System.out.println(putComma(1000001)); // here is the problem
}

you mean for this:
http://forum.java.sun.com/thread.jspa?threadID=784872

Similar Messages

  • Simulation Loop: Code could not be generated correctly for this VI

    Running LabView Simulation 8.2 on Windows XP laptop.  I have a Simulation Loop that keeps generating the following error message:
    "Simulation Loop: Code could not be generated correctly for this VI"
    The only reference I can find in my searches is to using an RTX target, which does not apply.  When I click on Show Error it just highlights the Sim Loop
    Any ideas on how to debug this?

    Perhaps you can start removing things until you don't get the error any more. How big is the code in the loop?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Hello please hepl me in my problem in apple id, i cannot connect to my ipad mini in itune store and app store because they find me a credit card but i dont have credit card. what can i do now? i need an answer for this problem. thank you

    hello please help me in my problem in apple id, i cannot connect to my ipad mini in itune store and app store because they find me a credit card but i dont have credit card. what can i do now? i need an answer for this problem. thank you

    I would suggest that you buy a visa or mastercard gift card and put a few dollars on it and use it to access the store.  Just add money to it before you want to buy something from the store and it will act like a normal credit card for you.

  • I can't connect my canon mp160 to my new apple iMac desktop. It just won't print although it comes up as the printer. there is no driver for this from canon who states that I probably don't need a driver for this

    I can't connect my canon xp160 to my new IMAC. It does recognize it but won't print. there is no driver for this as per Canon and they state that I may not need one. thanks!1

    If you want to print, then you will need a printer driver. There is no printer driver available from Apple for the MP160. And the last driver that Canon released for this model was for OS X 10.7. You may be able to install this 10.7 driver, although it is not digitally signed so Gatekeeper will block the installation. To get past Gatekeeper, you can hold down the Control key and click on the installer. A pop-up menu will appear. Select Open. You will then be given the option to install the old driver.
    With the driver installed, add the printer via Printers & Scanners and see if you can print.

  • I want to print directly from my iPad to a HP Officejet J6480 wireless printer.  Do I need an app for this or can I do it without and if so, how?

    I am a new iPad (wi fi version) owner but not the new iPad 2.  I have a home wireless network and have a HP Officejet J6480 wireless printer.  I print from my iMac and Powerbook directly using the wireless network and want to print directly from my iPad also.  Do I need a special app for this or can I do this with something already "built-in" to the operating system of the iPad.

    Welcome to Apple Support Communities.
    If you're comfortable going 'under the hood', this thread originally started in November 2010 contains a minor tweak to OS X that might work for you:
    https://discussions.apple.com/thread/2658720?threadID=2658720&tstart=0
    It allows devices on iOS 4.2 or newer to print to shared wired and wireless printers as long as the Mac is on and awake.

  • Need SQL code for this logic - -  From Serial and To serial no.

    In Forms 4.5 Screen I have two text boxes where i will be entering From Serial No
    and to serial no.
    I want the code which will check whether any number in between these from and to serial exists in a table or not ?
    For Example
    Select * from t; -- contains
    serial number
    321-456-789
    123-456-654
    321-569-986
    321-569-987
    When I enter from Serial no 321-456-789 and to serial no as 321-456-789.. I should get a message sayinig that 321-456-789 exists.
    When I enter from Serial no 321-569-986 and to serial no as 321-569-988.
    I should get a message sayinig that 321-456-986 exists.
    I should get a message sayinig that 321-456-987 exists.
    I should get a message sayinig that 321-456-988 not exists.
    is it possible with a SQL query or do we need to go for procedure or temp table ?
    If anybody ahving similar code please post it here.
    Thanks in Advance
    Devender

    Hi Devender,
    Try this :
    SQL> select * from t;
    SN
    321-456-789
    123-456-654
    321-569-986
    321-569-987
    SQL> var sn1 varchar2(11)
    SQL> exec :sn1 := '321-569-986'
    Procédure PL/SQL terminée avec succès.
    SQL> var sn2 varchar2(11)
    SQL> exec :sn2 := '321-569-988'
    Procédure PL/SQL terminée avec succès.
    SQL>1  select a.sn, decode(t.sn,null,'does not exists','already exists')
      2  from
      3  (select substr(replace(:sn1,'-','')+rownum-1,1,3)||'-'
      4        ||substr(replace(:sn1,'-','')+rownum-1,4,3)||'-'
      5        ||substr(replace(:sn1,'-','')+rownum-1,7,3) as sn
      6  from (select level
      7        from dual
      8        connect by level <= (replace(:sn2,'-','')-replace(:sn1,'-',''))+1
      9       )
    10  )a,
    11  t
    12* where a.sn=t.sn(+)
    SQL> /
    SN                            DECODE(T.SN,NUL
    321-569-986                   already exists
    321-569-987                   already exists
    321-569-988                   does not exists
    SQL> exec :sn1 := '321-456-789'
    Procédure PL/SQL terminée avec succès.
    SQL> exec :sn2 := '321-456-789'
    Procédure PL/SQL terminée avec succès.
    SQL> l
      1  select a.sn, decode(t.sn,null,'does not exists','already exists')
      2  from
      3  (select substr(replace(:sn1,'-','')+rownum-1,1,3)||'-'
      4        ||substr(replace(:sn1,'-','')+rownum-1,4,3)||'-'
      5        ||substr(replace(:sn1,'-','')+rownum-1,7,3) as sn
      6  from (select level
      7        from dual
      8        connect by level <= (replace(:sn2,'-','')-replace(:sn1,'-',''))+1
      9       )
    10  )a,
    11  t
    12* where a.sn=t.sn(+)
    SQL> /
    SN                            DECODE(T.SN,NUL
    321-456-789                   already exists
    SQL> Nicolas.

  • Need exact code for this

    In the transformation between 0FIGL_O02(table1) and ZSPM_D01(table2), delete records in 0FIGL_O02(table1), if 0AC_DOC_NO AND 0FISCPER AND 0COMP_CODE do not exists in 0FIAP_O03(table 3).
    need code for this...i have to implement it in BW.pls give me necessary code.
    Moderator message: please do more research before asking, show what you have done when posting, use meaningful titles when posting, read the rules of engagement.
    Edited by: Thomas Zloch on Feb 24, 2012

    Hai Pavan
    Check the following Code
    tables : mara.
    data : begin of itab occurs 0,
           matnr like mara-matnr,
           mbrsh like mara-mbrsh,
           mtart like mara-mtart,
           meins like mara-meins,
           end of itab.
    select-options : S_matnr for mara-matnr.
    initialization.
    clear s_matnr.
    refresh : s_matnr.
    s_matnr-low    = '0001'.
    s_matnr-high   = '0010'.
    s_matnr-Sign   = 'I'.
    s_matnr-Option = 'BT'.
    append s_matnr.
    start-of-selection.
    select matnr
           mbrsh
           mtart
           meins
           from mara
           into table itab
           where matnr in s_matnr.
    if sy-subrc = 0.
       sort itab by matnr.
    endif.
    if not itab[] is initial.
      loop at itab.
          if itab-matnr NOT  BETWEEN s_matnr-high AND s_matnr-low.
         if sy-subrc = 0.
           write :/ 'OK'.
         else.
           write :/ 'Not OK'.
         endif.
       endif.
      endloop.
    endif.
    Thanks & regards
    Sreenivasulu P
    Message was edited by: Sreenivasulu Ponnadi

  • Need sql querry for this logic

    Hi,
    Edited by: 937506 on Jun 10, 2012 7:35 AM

    937506 wrote:
    Hi,
    I have table like this,based on this table data i need one column for example "Value" based on this condition,
    KEY     A_VAL     ETA_VAL     RANGE     DATE_ID     SITE     AREA     UNIT     Monthnumber     Year
    1111     35     36     50.45     2778     PLANT1     AREA2     CDU-4     8     2011
    1111     40     41     50.45     2783     PLANT1     AREA2     CDU-4     8     2011
    9010     114     37     50.45     2779     PLANT1     AREA2     CDU-3     8     2011
    9010     41     35     50.45     2784     PLANT1     AREA2     CDU-3     8     2011
    9011     1500     38     50.45     2789     PLANT2     AREA3     DHT-1     8     2011
    9012     43     37     50.45     2774     PLANT1     AREA1     DHT-2     8     2011
    9012     38     39     50.45     2781     PLANT1     AREA1     DHT-2     8     2011
    9013     39     40     50.45     2782     PLANT1     AREA2     FCC     8     2011How to ask question
    SQL and PL/SQL FAQ

  • Need immediate remedy for this problem?

    Post Author: chakri_psnkc
    CA Forum: General
    Hi,
    we are using CR XI with DB2, we used store-procs for the reports. I have a report having Payment ID's in the main report under a group (more than 2000 ID's), and used 2 sub-reports which are detailed one linked to the payemnt ID in the main report. what I need is to show only the information of payment ID's who have less than 6 pages of information, if more than 6 pages then the payemnt ID's and it details has to be suppressed. if anyone have the solution for this problem are so appreciated if they post it ASAP.

    Post Author: IdoMillet
    CA Forum: General
    insert subreport in a header section. use shared var to signal to the main report the number of pages in the subreport.conditional suppress...

  • Simple file server accessible remotely with managed access. Do I need ML Server for this?

    Hello,
    I have a  Mac Mini that will be dedicated to serving 15 folders of documents to 7 people. It would be great if each person had their own password and I'd like to be able to decide what folders each user will have access to. The people need to be able to access the files from home and on the office network.
    Do I NEED to run OS X server for this Or can i accomplish this in OS X?
    I have to get this running quickly and I may not have time for the ML Server learning curve (even though it has been simplified).
    I tried to get ML server running on my machine a few weeks ago but got stuck. If setting up ML server with JUST the file server is dramatically easier I will try again. Can anyone please suggest a tutorial that takes me through simply setting up a remotely accessible file server with managed access with ML Server?
    V

    OS X client can serve files to remote clients, via both SMB/CIFS and AFS; via the Windows and OS X fiel services.  That's cheap, uses hardware you already have, and works fine.
    Most NAS boxes don't do distributed authentication.  Typically, you have credentials for the box at most.  Some of the mid- and upper-end boxes do offer distributed authentication, but that means having that authentication around.  At the low end, an Apple Time Capsule is a reasonable NAS box, and you can add an external disk.   And can be used for backups via Time Machine, too.  The mid- and upper-end boxes from Synology have a reputation for capabilities and flexibility.  There are (many) other vendors.
    I'm not a huge fan of LogMeIn for various reasons that I won't get into here, but that service does work for accessing hosts.  I don't know if that allows access to NAS directly, but I'd tend to doubt it.  You'd need to check with both LogMeIn and with the specs for whatever NAS box you're using.  
    Given the choice, I'd use a VPN.
    Using a VPN does mean you can control — at the VPN level — who can access your private network, so that can provide a broad-brush form of access control to your NAS device or your OS X client or your OS X Server box, if you go that route.
    I don't prefer to openly serve files to the internet, as the underlying protocols have occasionally had security issues and vulnerabilities, and the internet gremlins will find and will poke at any open ports and any accessible file servers.  I prefer to configure these services via VPN.
    VPNs are also more involved to set up, where LogMeIn can be simple.
    As mentioned previously, I'm also not a huge fan of the host-based VPN servers in OS X, though those do work.  The gateway boxes I've been using in the last year or so are probably not a good choice for a user that isn't familiar with networking  — the boxes provide a user interface that very definitely expect the user to understand IP and routing and related, but is both self-consistent and quite powerful — and they're cheap for what they can do, and they do work nicely.  ZyXEL ZyWALL USG series.  If you are evaluating any of these firewall boxes, then I'd definitely encourage downloading the manuals and making sure you can understand the available information.  The server-grade firewall boxes are almost inherently flexible and thus complex devices.
    One of the easiest ways is to work with somebody that does this sort of thing to sort through the options and requirements and trade-offs available here, and potentially to set up your VPN or NAS or server configuration for you.  (Disclosure: I offer this.)

  • Need the Logic for this Prg issue Pls

    Hi Friends,
    i have an urgent requirement..
    i am develop the report that is :
    Based on Selction Critirea kunnr(knvv-kunnr)
    i want Delete the
             Internet mail (SMTP) address FROM ADR6-MTP_ADDR
    AND Teletex number FROM ADR4-TTX_NUMBER..
    USING TABLES ARE KNVV , ADR6 AND ADR4.
    please how to Write the LOGIC For this Program .
    help me.. it is an urgent.. anyone.
    regards,

    Hi Alchermi,
    thanks for your reply soon.
    based on selction kunnr .. i want deete the ADR4-TTX_NUMBER..and ADR6-SMTP_ADDR From these 2 tables
    for these 2 fields..
    kunnr from knvv, selection field..
    below fields want be DELETED..
    ttx-number from adr4,
    smtp_addr from adr6.
    it is an urgent. help me .
    regards,

  • Do I need a MacPro for this?

    Alright, first off let me say that I know I do not need a MacPro to edit DV and to create motion graphics with FCP & Motion. But I am making credits right now for my latest video, and my machine is very verrryy slugish. Let me show you the clip which is open in Motion right now.
    [img=http://img132.imageshack.us/img132/5798/picture1cy1.th.png]
    Now, I am making that file on my Macbook Pro that has 2 gigs of ram. The external drive that has all the media on it is sending it via FW400. I have nothing else hooked up as far as drives or cables go. If I got the MacPro with, let's say, the Radeon X 1900XT, would this file be able to play in Motion full frame rate? It's playing at like, not even 1 frame!, on my Macbook Pro. Are laptops really this slow in these apps? Is it because of the small graphics card?
    mbp 2.0   Mac OS X (10.4.8)  
    mbp 2.0   Mac OS X (10.4.8)  

    IF you can, try posting a link to the Motion project. I'll give it a run on my system and tell you how fast it's running.
    You can do some of the stuff in Final Cut and other things in Motion. For thsi project I would do the scrolling text in Final Cut after everything else if pieced together in Motion.

  • Do I need special chracteristics for this?

    Hello,
    I am working on a project and the requirements demand three reports, with following columns:
    1) Previous Month, Month 1, Month 2, ..., Month 6, First 6 Months Total
    2) Previous Quarter, Quarter 1, Quarter 2, ..., Quarter 6, Tot First 2 Quarters
    I am used to using key figures as the columns and characteristics in the Dimension as the rows. Do I need to create: Previous Month, Month 1, Month 2, ..., Month 6, First 6 Months Total, Previous Quarter, Quarter 1, Quarter 2, ..., Quarter 6, Tot First 2 Quarters; as key figures?
    If not, I will appreciate any suggestions.
    Or, is there a way to achieve this with the Time Dimension?
    Thanks in advance.

    Hi Amanda,
    You don't have to create so many chars.
    You can bring into cube just a 0CALMONTH, 0CALQUARTER and 0CALYEAR, feeding data simply with 0CALMONTH and use an automatic conversion from month to quarter and year.
    Then in BEx you create variables based on a 0CALMONTH, 0CALQUARTER and 0CALYEAR. Create a structure in BEx designer, put into columns your KF, restrict it by created variable, say for a current month, then make a new selection in the structure, put there your KF again and restrict it by the same variable but with offset = -1. Do the same for Month - 2 etc. The similiar procedure is going to be for quarters and years.
    Best regards,
    Eugene

  • A dictionary ADT - I need the answer for this by tomorrow

    I need an ADT that maintains a set of keys (that can be sorted - numbers for example) that implements inserting and deleting a key in O(1) time worst-case and finding a key in O(n*log(n)) time worst-case. Also, the amortized time complexity of all operations should be O(log(n)).
    I need a description of the data structure (no code/pseudo-code) and proofs about the running time complexities...
    Thank y'all!

    I live near the east coast (50 miles) but evenif
    a
    lived on the east coast I could not see the
    ocean,
    just the North Sea.I live near the West coast of the Netherlands, but
    some might say everything in the Neterlands is
    coast... I too am not able to see the ocean
    directly.So you see the same sea that I would see if I could
    see the sea!Exactly!
    And if I were the OP, I'd see to it to see the sea soon, because you'd see things much clearer afterwards, so that I wouldn't have to see off this assignment. See?

  • I want to run Lexware on my imac and was told I need bootcamp / parallels for this. Are there any downsides to this?

    Hello, I need to run bookkeepting/ bill writing/ store management software on my imac and would like to use Lexware's German product (equivalent of Quickbooks), which can directly link to the German tax autorities. I was told I can do this from my imac via Bootcamp (they dont do a mac version).
    Is this advisable and are there any downsides? Is it simple enough? Do I need to be online to use the Lexware software (I live in the deepest countryside with a wobbly connection!).
    Thanks a lot for any hints or advice.

    There shouldn't be any issues as Boot Camp allows installation of Windows which runs natively just as if you were on a PC. The only downside is that you have to buy a Windows full install disk. Be sure it is the right version for your software.

Maybe you are looking for

  • Can castor retrieve the comnstraints provided in an xml schema

    hi, plz help me !!!!!!!!!!! does castor provide any function to retrieve the constraints defined in an xsd i know it provides functions for setting the constraints can i retrieve the value of constraints fromthe descriptor files returned by cator whi

  • Digital Watermarking

    hi, Searching for help in Digital Watermarking. I hardly find java source code from the web. Hope can get some help here. if anyone have java source code of digital watermarking, please send me a copy at: [email protected] thanks a lot Siang

  • Choppy music through earphones on iPhone 4S (music + earphones not faulty)?? HELP!

    My iPhone 4S was working fine, then suddenly the music through the earphones became choppy earlier this afternoon. I have two pairs of earphones and they are working well on my other music devices. The music also works fine on speaker so it is not a

  • Multible I/O Streams on Socket

    tachwohl How can a Server send multible I/O Stream to a single User at the same time? Ok, I have the following problem. This days, I'm coding a Client/Server Application. The Client/Server Connection is "should" be static during runtime. The Server a

  • Fox News Talk on iTunes Radio

    Yet again, Fox News Talk is not working on the iTunes Radio. Someone please fix this!