954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

integer array to primitive integer conversion

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.

adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1
 
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

DavidKroukamp
Practically a Master Poster
Team Colleague
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
 

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?

adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1
 
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 
            }
        }
DavidKroukamp
Practically a Master Poster
Team Colleague
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
 

Thanks...

adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You