Garry, please [url=http://faq.javaranch.com/view?UseCodeTags]add code tags[/code] to your post. You can edit your post using the icon at the top right of it. Thanks!
And welcome to the Ranch! [ February 12, 2005: Message edited by: Ilja Preuss ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Garry Meax: thanks a lot guys.
i have managed to do it but it is quite long. is there a short way for this.
Long ??? That program is tiny... you should would not worry about how long ( or how many lines) your program has at this point. It easier to debug this way and you can clearly see the logic behind your own code ( readability )... but here is a "short" version of your program