JAVA Array - how to put integer 0 into it?

Put your problem here if it does not fit any of the other categories.

JAVA Array - how to put integer 0 into it?

Postby svebee » Thu Apr 29, 2010 9:58 pm

It works with all numbers >0, if I try to put integer 0 into it, it reads it as "nothing" so for example I put these integers into array

[12][3][0][45]

and if I print that (integer) array out I get

[12][3][45]

How to solve that problem?

Warning: It must be an integer, not string, because I need to do some calculations with it :wink:
svebee
Junior Developer
Junior Developer
 
Posts: 21
Joined: Wed Apr 21, 2010 10:19 pm

Top

Postby Neondog » Thu Apr 29, 2010 10:39 pm

How are you loading it into an array and how are you taking it out of the array. Have you tried converting it to a string, storing it an array, and then pull it out of the array as a string and then convert back to an integer?
Neondog
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Apr 28, 2010 8:58 pm

Postby svebee » Thu Apr 29, 2010 11:26 pm

It was in the database in the string, then in array string and then in array int. I just put it on the front of the array and it worked :? I don't know how or why, but it just works :? :)
svebee
Junior Developer
Junior Developer
 
Posts: 21
Joined: Wed Apr 21, 2010 10:19 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 21 guests