Since i am new to java, so please tell me that is there any way by which i can convert integer array to primitive int?? if yes, give some code.

Recommended Answers

All 4 Replies

Since i am new to java, so please tell me that is there any way by which i can convert integer array to primitive int?? if yes, give some code.

im confused, an integer array should contain an array of integers, and integers are already primitive?... but see here:http://stackoverflow.com/questions/564392/converting-an-array-of-objects-to-an-array-of-their-primitive-types and here:http://stackoverflow.com/questions/718554/how-to-convert-an-arraylist-containing-integers-to-primitive-int-array

What i actually mean is that if at index 0, value stored is 49 and at index 1, the value stored is 50 then can i take it as 4950? can it be done?

What i actually mean is that if at index 0, value stored is 49 and at index 1, the value stored is 50 then can i take it as 4950? can it be done?

well taking from your last posts maybe this?:

String tmp="";//variable to concatenate integers to string
        for(int i=0;i<ret.length;i++){
            if(ret[i]!=0) {
                System.out.print(ret[i]+",");
            tmp+=ret[i];//add integer to previous string value 
            }
        }

Thanks...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.