from int to BigInteger

Discussion in 'Case Modding' started by dogy2005, Nov 4, 2010.

  1. dogy2005

    dogy2005

    Joined:
    Nov 4, 2010
    Messages:
    1
    Likes Received:
    0
    Hello,
    could somebody help me to overwrite my simple program?

    old

    int delitel;
    int cislo;

    for ( cislo = 0; cislo <= 29876; cislo++)

    delitel = 3;
    String retezec = "";

    while (cislo > 0) {
    retezec = (cislo % delitel) + retezec;
    cislo /= delitel;
    }
    System.out.println(retezec);
    }
    }
    }

    new

    import java.math.BigInteger;
    import java.io.*;
    import java.util.*;
    import java.lang.*;

    public class madrid {
    public static void main(String[] arg) {
    {
    BigInteger cislo = new BigInteger("3");
    cislo = cislo.pow(400);

    BigInteger numberB = new BigInteger("1");

    while ( true ) {
    cislo = cislo.add(numberB);
    if ( cislo == cislo.pow(400)) break;

    BigInteger delitel = new BigInteger("3");

    String retezec = "";

    while ( cislo > 0 ) {

    retezec = ( cislo.mod(delitel) ) + retezec;

    cislo = cislo.divide(delitel);

    System.out.println(retezec);
    System.out.println(retezec.length());
    }
    }
    }
    }
    }

    I dont know what to do with this parts

    while ( cislo > 0 ) { //maybe ther must be true
    retezec = ( cislo.mod(delitel) ) + retezec;


    while ( true ) {
    cislo = cislo.add(numberB);
    if ( cislo == cislo.pow(400)) break;

    insted of

    for ( cislo = 0; cislo <= 29876; cislo++)

    or if somebody can check if everything is correct? Thank You

    result is combination of 0,1,2
     
    dogy2005, Nov 4, 2010
    #1
    1. Advertisements

  2. dogy2005

    elktron

    Joined:
    Feb 16, 2011
    Messages:
    5
    Likes Received:
    0
    wait guys to help
     
    elktron, Feb 17, 2011
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.