Are you aware of Scanner? You can also find many examples of how to use Scanner to do what I think you're trying to do, but I may not understand your question.
Two of the many cool things about Java is that the Core Java API is so rich and that there are many third party libraries that do most anything else the core libraries do not do, or, in some cases, do the same thing only better. I'll relay what I was told early in my Java study, "Don't reinvent the wheel." Instead, I suggest you learn from the inventors who've blazed the trails.
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Joined: Jul 16, 2012
Thank you I was not familiar with the Scanner class.
I'm coming from C# so although I've been able to pick the java language quickly,
but I know very little about most of the libraries (of coarse i'm trying to change that.)
That's cool. Just ask if you have similar, "How do I . . .?" questions. Most basic Java tutorials/books will introduce you to the fundamental classes. Some free books and cheat sheets are available online from which you could quickly cross reference your existing programming knowledge by scanning the reference's Table of Contents.
You should also be aware of the online Java Tutorials that usually come up if you Google a Java topic. For example, if you Google "java input" the first result is the Java Basic I/O Tutorial that covers many I/O topics, including Scanner.