Toby_1

I need to make some KML code that is basically a coloured track. So far I have worked out that it either has to be lots of small lines or placemarks. However usually with this there is no way to use the time bar. Is there a way to be able to have lots of small lines/placemarks that are affected by the timebar.

Thank you.

Toby_1

I tried printing out the numbers of n and i, it seemed to start on apparently random numbers.

I changed the loops to while loops and it sorte out that problem but now it doesn't get a palindome.

package euler;

public class problem004 {

    String reversed;

    public static void main(String[] args) {

        int product =0;
        String stringproduct;
        int i = 999;

        int n = 999;

        //cycles through all the numbers
        while(i>=100){

            //System.out.println("i equals" + i);

            while(n>=100){

                product = n*i;
                stringproduct = product + "";

                problem004 reversing0bject = new problem004();
                reversing0bject.reverse(stringproduct);

                //if the string is a palendrome
                if(stringproduct.equals(reversing0bject.reversed)){

                    System.out.println("answer is"+stringproduct);
                }
                //System.out.println("n equals" + n);

                n--;
            }

            i--;

        }

    }

    //reverses the string order

    void reverse(String rev){

        //""turns it to a string
        reversed = new StringBuffer(rev).reverse() + "";

    }

}

Toby_1

oh thank you. I assumed because it was the same class it would change the variable.
this si the answer it printed:
answer is17271

However this is wrong.

Toby_1

I am still having no output. I have used the .equals method but nothing.

package euler;

public class problem004 {

    String reversed;

    public static void main(String[] args) {

        int product =0;
        String stringproduct;

        //cycles through all the numbers
        for(int i=999;i>=100;){

            for(int n=999;n>=100;){

                product = n*i;
                stringproduct = product +"";

                new problem004().reverse(stringproduct);

                //if the string is a palendrome
                if(stringproduct.equals(new problem004().reversed)){

                    System.out.println("answer is"+stringproduct);
                }

                n--;
            }
            i--;

        }

    }

    //reverses the string order

    void reverse(String rev){

        //""turns it to a string
        reversed = new StringBuffer(rev).reverse() + "";

    }

}

Toby_1

I am on euler project 4, the largest palendrome product of 2 3digit numbers.

Here is the program, however it doesn't print a value.

please help.

package euler;

public class problem004 {

    String reversed;

    public static void main(String[] args) {

        int product =0;
        String stringproduct;

        //cycles through all the numbers
        for(int i=999;i>=100;){

            for(int n=999;n>=100;){

                product = n*i;
                stringproduct = product +"";

                new problem004().reverse(stringproduct);

                //if the string is a palendrome
                if(stringproduct == new problem004().reversed){

                    System.out.println("answer is"+stringproduct);
                }

                n--;
            }
            i--;

        }

    }

    //reverses the string order

    void reverse(String rev){

        //""turns it to a string
        reversed = new StringBuffer(rev).reverse() + "";

    }

}

Toby_1

for(long i = 1;i< 600851475143; i++ ){

The rest of the code works however I am testing against this number and I get an error: Out of range of int.

How can I create boolean tests against a larger variable.

Thank you.