# Thread: Convert int[] to int

1. Senior Member
Join Date
Dec 2016
Posts
103
Rep Power
0

## Convert int[] to int

how we convert int array to normal int...

2. ## Re: Convert int[] to int

And there is a one-liner question again. Stop dropping the oneliners in here, and ask a decent question. Give us an example, this is what I am trying, this is what I got instead, this is the error message, etc.

Let me start by asking what is a "normal int"?

3. Senior Member
Join Date
Dec 2016
Posts
103
Rep Power
0

## Re: Convert int[] to int

sorry..

i want that

int arr[]={1,2,3,4,5,6,7,8,9,10}

i want to conveert this into int

4. ## Re: Convert int[] to int

You can't convert 10 ints to one int, unless you perform some operation on them like add, substract, etc.

Using your own example, what would be the expected result?

5. Senior Member
Join Date
Sep 2014
Location
MA, USA
Posts
399
Rep Power
7

## Re: Convert int[] to int

I would argue that there are already 10 int.

6. Member
Join Date
Mar 2017
Posts
10
Rep Power
0

## Re: Convert int[] to int

Hi,

To be honest, I am a bit new to java, but let me give you a simple tip from what I have learned up until now.
I wrote your title "Convert int[] to int" and found the same question from almost 6 years ago on another forum.

Any way, regarding your question, it really depends what you want your output to be.

Lets say we have int[] a = {1,1,2,3} do you want the output to be 1 int of 1123?
Or maybe you meant it should be 1 random int out of the 4 ints inside the array?

Without an explanation of what you want the output to be get it is impossible to help you...

7. Member
Join Date
Apr 2017
Posts
5
Rep Power
0

## Re: Convert int[] to int

Originally Posted by NirelG
Lets say we have int[] a = {1,1,2,3} do you want the output to be 1 int of 1123?
Are you implying that his int[] a has a value of 1123?

8. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
6,226
Rep Power
14

## Re: Convert int[] to int

No. I am certain he is trying to figure out what the OP wanted. So summing up the array values where each element occupies an appropriate
power of ten would "convert" the int array to an single int. But it's a stretch. Bottom line, it does not make sense to talk about converting
an array of type T to a single value of type T unless you do some kind of reduction on the array.

Regards,
Jim

9. ## Re: Convert int[] to int

It's not uncommon for this poster to dump a question and never come back. I wouldn't worry too much about it.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•