StringBuilder insert question

Hello
I'm trying to insert integer values into a StringBuilder object. With single-digit values, it's OK but when I (example 14) two-digit values it is interpreted as 1 and 4 and he started in the StringBuilder as two separate values 1 and 4 instead of just 14.
How can I stop this from happening?
 static void perfect( int number ){

StringBuilder sb = new StringBuilder();

for( int j = 1; j <= number - 1; j++){
                    if( number % j == 0 ){

                         sb.insert(0, j);
.
.
.
.
.
}

As jverd says what you need to do is insert a comma before each value except the first.

loop {
    if content is not empty {
        insert comma
    }
    insert value
}

Tags: Java

Similar Questions

  • Insert question

    Hello

    I have a problem I guess is super simple but I'm stuck

    My defective insert with:

    ERROR on line 5:

    ORA-00984: column not allowed here

    INSERT INTO emp
    (EMPLOYEE_ID,LAST_NAME,DEPARTMENT_ID)
    VALUES
    (10,
    NOOB,
    99)
    

    / / DESC emp

    Name                                                                     Null?    Type

    ------------------------------------------------------------------------ -------- -------------------------------------------------

    EMPLOYEE_ID NOT NULL NUMBER (2)

    LAST_NAME NOT NULL VARCHAR2 (25)

    DEPARTMENT_ID NOT NULL NUMBER (2)

    JOB_ID                                                                            VARCHAR2(8)

    SALARY                                                                            NUMBER(10,2)

    I also added a view of the table with

     create or replace view test_view AS
    select employee_id, last_name, job_id
    from emp
    where job_id like 'SA_%'
    with check option;
    

    Anyone know why I get this error?

    Simple syntax error.  You need single quotes around 'Noob '.

  • record insert question

    problems with the record insert on dwmx2004. I have a number of large database tables and I want to get all the information in the database with several inserts Records and a post on a single page. I did the multipe recordsets in a POSITION with smaller files in the past, but for some reason any dw doesn't let me do it now with a more complex page. is there something I'm missing or should be done differently?

    specifically, the record insert Panel won't save the connections between the name of the form and the fields of database, with the exception of the first. weird. suggestions?

    figured it out. I removed the table in the form and put it in another file and try again. Fortunately, he worked half, and so I had the chance to see what was wrong. ATTENTION: Make sure that your form names have no space after them before clicking on enter. mine has unique spaces - which you could see in the code view - guarding them to link to the db via the recording fields to insert the tool. at least this is what I think... just an amateur.

  • Noob on the Insert question

    IM using oracle 10.1 with sql developer. I have to insert multiple values in the database and I know how to enter a value in writing this

    insert into the table
    values (serial_nmbr.nextval,
    "& value ',"
    "(& valeur ')"

    But I have about 50 values that I need to enter and I wanted to know if there was a way to insert at the same time instead of run this statement 50 times...

    zetagirl1920 wrote:
    IM using oracle 10.1 with sql developer. I have to insert multiple values in the database and I know how to enter a value in writing this

    insert into the table
    values (serial_nmbr.nextval,
    "& value;
    "& value)

    But I have about 50 values that I need to enter and I wanted to know if there was a way to insert at the same time instead of run this statement 50 times...

    If it's just a one time thing, it would have been easier faster simply encode a sql script:

    Notepad doit.sql...

    insert into my_table values (serial_nmbr.nextval,'some value','some other value');
    insert into my_table values (serial_nmbr.nextval,'still another value','yet something else again');
    
    .
    .
    .
    

    then in sqlplus

    sql> @doit
    

    The doit.sql would be easy enough with a small copy'n ' paste and search'n ' replace.

    A rough way but if it's a turned moment you could all have done in a few minutes.
    insert into my_table values (serial_nmbr.nextval, 'still another value "," yet another value');
    .

    Published by: EdStevens on October 30, 2009 11:12

  • Re-insert the 8 Captivate quiz results slide

    I created a course of six modules, which all have a short quiz at the end. During the preview of the project with the project manager, quiz slides do not move forward in the preview of the course (and no more than the bar room). I had to go and remove the quiz slides and slides of results in order to highlight the entire course of my manager.

    Now that I'm trying to work on game shows, I am able to insert question slides but not the results slides that I would appear at the end of each short quiz.  This could be a framework global quiz I should change? Is there a way I can reset the quiz in the course and start from the beginning (with slides of results displayed)?

    I realize it's probably 101 stuff for everything that you users of Captivate veterans, but please bear with me... I am a newbie to Captivate.

    Thanks in advance for your ideas!

    I am little confused: you can have only a single slide quiz and 01:20 in a CP-file (requirement of SCORM) and you seem to talk about several slides of results?  That should mean that you have created custom intermediate score slides as I explained here: Intermediate Score slides - Captivate blog

    Or each module in a separate cptx file? The slide of score will not be deleted at all, it's just hidden. You can make it visible again using preferences, settings, "Score at the end of the Quiz Show" Quiz

    Regarding the reset of the questions that is possible using the recovery button. Return to the user will be sent to the first slide question or being marked. This means that you will have to provide more than 1 attempt on Quiz level. More information about the slide in question/score:

    Question Question slides in Captivate - Captivate blog

    Question Question slides - part 2 - Captivate blog

  • Question pool in Captivate 5.5

    I want to create a Pool of about 30 questions where users will only receive 5 questions to answer that will appear randomly.

    I created the question pool. But how only 5 questions available in the pool for users to answer?

    I am using Captivate 5.5.

    Go to insert > Questions and select the random option.  The value of the number 5.  Select your favorite pool question as the location where the questions will come.

  • Questions and the Quiz Question box misalignment Cap 7

    I work in the latest version of Captivate 7.0.1) subscription version and added a question true/false quiz at the course. The inserted question aligns the selection 'box' (circle) correctly for the first response, but not for the second. This is true for the multiple choice questions as well.

    The master looks very good, there is no extra space in the text of the question (it occurs without the addition of content), there is no way to close the gap of space. If I move the text, the misaligned selection box moves with it and keeps the difference.

    I imported a question of another master, and it works very well, so I have a workaround, but I would like an answer to what is the cause, so I don't inadvertently re-create the problem if it's my fault. And if it's a bug, then Adobe should jump on this one.

    Images - example misaligned

    misalign.jpg

    and aligned example imported from another master

    misalignnot.jpg

    Uncheck the Auto size legends in Preferences > by default.

    Anthony

  • Options of branches for Questions Correct/Incorrect

    Hi all

    I found a tutorial on the net showing how branch correctly according to the status of the response.

    That's what my options are currently similar when I edit a question

    Mine.JPG

    It is the example that shows the tutorial.

    Tutorial.JPG

    I would like to know what measures would be needed to get the options to display

    http://www.webgrok.com/rmyers/print/capquiz.PDF

    Thanks in advance,

    Michael Lantz

    Hi Michael,

    You use a Question Pool? When you do, you are not given the same navigation options when simply inserting question slides. Ramification of question slides is possible only when you do not use a question pool.

    ERR229

  • Creating a non-linear interactive video

    Hello

    I would like to know if it is possible to create non-linear interactive video in adobe captivate 9?

    I would like to design a video course with multiple options of connections according to responses from users on the way.

    Thank you

    Emmanuel

    You must have different video clips and inserting question slides between the video clips which are each on a slide.

  • anti hitTest?

    I tried to find a way to get video film effects work only WHILE the two objects are colliding with each other. It seems after that they collide, however, they no longer need to be in contact for the supposed to be conditional command. In an attempt to circumvent 'Positioning Test', I did a fake hitTest, below:


    function area (mc zquestion) {}

    If (man._y < mc._y + 25 & & man._y > mc._y-25 & & man._x < mc._x + 25 & & man._x > mc._x-25) {}
    mc.onRelease = function() {}
    trace (zquestion);
    }
    } else {null};

    }

    onEnterFrame = function() {}

    area (Block1, "Insert Question here?");

    If (Key.isDown (Key.Left)) {man._x-= 5 ;}
    If (Key.isDown (Key.Right)) {man._x += 5 ;}}
    If (Key.isDown (Key.up)) {man._y-= 5 ;}
    If (Key.isDown (Key.Down)) {man._y += 5 ;}}

    }

    except my attempt at "null/nothing" If coordinates equal all this has failed. Really, I don't understand the "else" command and would like to know how to create a ' If NOT X, then don't NO Y.

    use:

    function area (mc zquestion) {}

    If (man._y < mc._y="" +25="" &&="" man._y=""> mc._y-25 & man._x < mc._x="" +25="" &&="" man._x=""> mc._x-25) {}
    mc.onRelease = function() {}
    trace (zquestion);
    }
    } else {delete mc.onRelease ;}
       
    }
       
       
       
       
       
    onEnterFrame = function() {}
       
    area (Block1, "Insert Question here?");
       
       
       
    If (Key.isDown (Key.Left)) {man._x-= 5 ;}
    If (Key.isDown (Key.Right)) {man._x += 5 ;}}
    If (Key.isDown (Key.up)) {man._y-= 5 ;}
    If (Key.isDown (Key.Down)) {man._y += 5 ;}}
       
       
    }

    except my attempt at "null/nothing" If coordinates equal all this has failed. Really, I don't understand the "else" command and would like to know how to create a ' If NOT X, then don't NO Y.

  • Insert a column in the table (perhaps a silly question?)

    This may seem a stupid question, but is - it possible in Labview to insert a new column in a table that is established? For example, if I have a 2 column table is it possible to insert a new column between two columns? If not is there another tool such as a table or something I should use, and how do you use it?

    Thank you

    Hi LV.

    Use the Vi 'insert Array"as shown:

    RGS,

    Lucither

  • Question slide insert problem in Captivate 9 Responsive Design project

    I'm trying to insert a question after a slide in the project but Captivate keeps placing below the new issue with a pile of other issues in the project. When she did this, I can't move the slide to the post I want to in class stream nor can I move any other current slide. What should I try?

    That's what I did: I deleted the cache. I tried the previous iterations of the project without result. A conditional question: I am not connected to the internet on this computer. which would affect the behavior of classes?

    I don't know if there is any problem with how to set quiz preferences but I don't know that I have not had any problems with the insertion of slides where I wanted them earlier in the development of the project.

    Thanks in advance for your help.

    Chris

    The usual reason for this behavior is that you try to insert a quiz with Questions before the test.  Questions before the test can be placed at the beginning of a lesson BEFORE all other issues for the main quiz quiz.

    You may have several types of quiz in this module?

  • I agree with Ccider, try to talk to anyone from Adobe is a joke. It is, when Adobe will get the Quick Time 7 code inserted by Apple resolved question of blocking?  Like others, I touch PSE14 until they do.

    I agree with Ccider, try to talk to anyone from Adobe is a joke. It is, when Adobe will get the Quick Time 7 code inserted by Apple resolved question of blocking?  Like others, I touch PSE14 until they do.

    frankv11114037 wrote:

    I agree with Ccider, try to talk to anyone from Adobe is a joke. It is, when Adobe will get the Quick Time 7 code inserted by Apple resolved question of blocking?  Like others, I touch PSE14 until they do.

    I'm curious, what exactly is your problem?

    The system requirements for PSE14 and ss14 requires Quick Time 7 on Win or Mac.

    I just checked that I had not installed on my PSE14 on 10 to win Quick Time 7. No problem, but I rarely videos, and I have other viewing software like VLC media player.

    Just out of curiosity, I installed Quick Time 7 without problem.

    Wouldn't be a problem with Premiere Elements or Mac?

  • A question about the insertion of the localTimeStamp returned the value into a timestamp with time zone column

    Hello

    Oracle version: Enterprise Edition Release 12.1.0.1.0 - 64 bit

    OS: CentOS 4.6 X86_64                  

    I have a question about the localTimeStamp function. According to the documentation for this function is
    the same thing as current_TimeStamp except that the returned value does not include the time zone.

    Consider the following example:

    SQL > create table tmptab (colval timestamp with time zone not null);

    Table created.

    SQL > insert into tmptab (colval) values (localTimeStamp);

    1 line of creation.

    SQL > select t1.colval, tmptab from t1;

    COLVAL

    ---------------------------------------------------------------------------

    24 JANUARY 14 09.45.42.253732 H + 01:00

    SQL >

    Why introduce the foregoing did not fail? the data type of the column in my table colval expects a timestamp with time zone

    during each which inserts as I understand (correct me if I'm wrong) is not provided by the localTimeStamp function.

    Could someone kindly tell me what I misunderstood?

    Thanks in advance,

    dariyoosh wrote:

    Hello

    Oracle version: Enterprise Edition Release 12.1.0.1.0 - 64 bit

    OS: CentOS 4.6 X86_64                  

    I have a question about the localTimeStamp function. According to the documentation for this function is
    the same thing as current_TimeStamp except that the returned value does not include the time zone.

    Consider the following example:

    SQL > create table tmptab (colval timestamp with time zone not null);

    Table created.

    SQL > insert into tmptab (colval) values (localTimeStamp);

    1 line of creation.

    SQL > select t1.colval, tmptab from t1;

    COLVAL

    ---------------------------------------------------------------------------

    24 JANUARY 14 09.45.42.253732 H + 01:00

    SQL >

    Why introduce the foregoing did not fail? the data type of the column in my table colval expects a timestamp with time zone

    during each which inserts as I understand (correct me if I'm wrong) is not provided by the localTimeStamp function.

    Could someone kindly tell me what I misunderstood?

    Thanks in advance,

    Then, when you do

    create table t (neck DATE);

    Insert into t (to_date ('1st January 2014', ' mon-dd-yyyy "");)

    Are you surprised that it works? After all a DATE column contains a time component, you do not provide: but he

    works and gives you 00:00:00 as the component "hour".

    Similarly, the timezone component is being developed to automatically with, I think, time zone of your system.

  • Trigger Oracle (INSERT ONLY) question (Table of historical data)

    What I have to do is follow the changes that are taking place on a table. The requirement is that it must be a trigger. The question I have is that a MERGE statement is moving data to another table that I monitor, which creates tons of changes (which are really just duplicates).

    The underside of work... with the exception of INSERTING it. When a change or remove met him, archives... but not INSERT it. I noticed that when I put where when to '=' instead of '<>', INSERTS will be saved (but obviously when new old =, which I don't want). The problem seems to be the "WHEN".

    Any suggestions...?

    CREATE OR REPLACE TRIGGER SCHEME. TRIGGERTEST22
    After you INSERT or DELETE or update T_RESOURCE_ENTITY
    THE ONTARIO SCHEME. TABLE
    FOR EACH LINE
    WHEN (nvl (new. T_RESOURCE_ENTITY, 'YYY') <>NVL (former. T_RESOURCE_ENTITY, "XXX"))
    BEGIN
    IF (VALUES) THEN
    INSERT IN THE SCHEMA. TABLE_HISTORY2 (ARCHIVED_BY, ARCHIVED_DATE, ARCHIVED_TYPE, COLUMN_NAME, COLUMN_VALUE_NEW, COLUMN_VALUE_OLD)
    VALUES ('USERNAME', SYSDATE, 'IN',: new.) T_RESOURCE_TYPE,: new. T_RESOURCE_ENTITY,: old. T_RESOURCE_ENTITY);
    ELSIF (UPDATE) THEN
    INSERT IN THE SCHEMA. TABLE_HISTORY2 (ARCHIVED_BY, ARCHIVED_DATE, ARCHIVED_TYPE, COLUMN_NAME, COLUMN_VALUE_NEW, COLUMN_VALUE_OLD)
    VALUES ('USERNAME', SYSDATE, 'UP',: new.) T_RESOURCE_TYPE,: new. T_RESOURCE_ENTITY,: old. T_RESOURCE_ENTITY);
    ELSIF (DELETING) THEN
    INSERT IN THE SCHEMA. TABLE_HISTORY2 (ARCHIVED_BY, ARCHIVED_DATE, ARCHIVED_TYPE, COLUMN_NAME, COLUMN_VALUE_NEW, COLUMN_VALUE_OLD)
    VALUES ('USERNAME', SYSDATE, 'DEL',: new.) T_RESOURCE_TYPE,: new. T_RESOURCE_ENTITY,: old. T_RESOURCE_ENTITY);
    END IF;
    END;

    : old is NOT available to INSERT.

    This means a trigger will not be enough.

    -----------
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for