chi Lin

Ranch Hand
+ Follow
since Aug 24, 2001
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by chi Lin

For that you need a way to pad the output, cattleDrive provide a method there, change " " to "0".

Originally posted by Sultan A. A:
Thanks for help, but the problem now is the output like this
1 10 11 100 101 110 111
I want it like
001 010 011 100 101 110 111

thaks for help me again,

[ October 01, 2004: Message edited by: chi Lin ]
19 years ago

[ September 28, 2004: Message edited by: chi Lin ]
19 years ago

it should be
19 years ago
use the ? : operator.
[ June 26, 2004: Message edited by: chi Lin ]
19 years ago

As Tim mentioned if you want to use Integer.parseInt(), you
have to handle the exception otherwise the program may terminated
ugly with some annoying exception message when user enter non-parsable string.

Originally posted by Tim West:
If you want to use parseInt() to implement isInteger(), you'll have to catch the exception.

19 years ago
first thing come to my mind is :

looping through the String s, for each
character ues Character.isDigit() to check.

Also pay attention to the possible positive/negative sign
at the beginning of the String s, as +/- are not digits
but could be part of valid integer.
[ June 14, 2004: Message edited by: chi Lin ]
19 years ago

user just inputs something and it gets printed out again

Things got complicated because you are not just got
anything from user then output it.

With System.out.print("Enter a number: ");
You are asking user to enter a number, then Integer.parseInt(input)
convert the input from String to integer.

Problem is user may not always follow the instruction and might enter something that is NOT parsable to integer.

To check this, the code was wrapped into try-catch block for possible Exception.
[ June 13, 2004: Message edited by: chi Lin ]
19 years ago

I am palying with JFileChooser, I put out some code and it does shows
a openDialog box when run.

Problem is the program does NOT terminate after I choose a file & click OK.
(I did not see the promt appear)

Please advise if I did something wrong ?

[ June 11, 2004: Message edited by: chi Lin ]
19 years ago
First follow Ernest's advice by adding


you should see some difference.
19 years ago
1. usel Calendar.getInstance() to get a Calendar object.
2. call set(year, month, data) to set the date you need
3. call get(Calendar.DAY_OF_WEEK) to get the day, it return a number between
1 - 7 (Sunday - Saturday).

19 years ago
You need Collections.shuffle(Arrays.asList(cards);
19 years ago