If you are sure the format is going to be MM/dd/yyyy and you don't need to check if the string really contains a string in this format, then just using substring is the quickest and shortest way to do it.
If you need the year in an int, then ofcourse you can parse it using Integer.parseInt(...).
In Java 1.3 one test I conducted showed substringing around 100x faster than parsing a date and going back toString() in another format. Unless you have thousands of these in the code path while the user is waiting for results, they'd never notice that time difference though.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
A berm makes a great wind break. And Iwe all like to break wind once in a while. Like this tiny ad:
how do I do my own kindle-like thing - without amazon