how to represent negative number to array of integers ?
- by stdnoit
I must convert string of 1324312321 to array of integers in java
this is fine. I could use integer parseint and string substring method
but how do I repesent -12312312 to my original array of integer..
the fact that - is a char / string and convert to array of integer would alter the value ( even though I convert - to integer-equivalent , it would change the rest of 12312312)
it must be an array of integers and how should I convert negative numbers and still keeep the same value
somehow reminding me of two complements trick but i dont think i need to go down to binary level in my program..
any other trick for doing this?
thanks!