PDA

View Full Version : Few simple java questions...




noel4r
Apr 19, 2007, 03:40 PM
1. How do I read an input one character at a time?

2. Let's say we have an int x = 3838139, how can I refer to the 5th digit (1)? Example, is the 5th digit greater than 5?

3. How do I convert an integer to a int array? Example 145 becomes an array w/ elements 1, 4, 5.



toddburch
Apr 19, 2007, 04:04 PM
2) Convert the integer to a string and use substring.
3) Convert the integer to a string, then the string to an int array, by substringing one digit at a time.