This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes Code review required for converting dateformat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Code review required for converting dateformat" Watch "Code review required for converting dateformat" New topic
Author

Code review required for converting dateformat

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

No it's not. At least not quite. There is (at least) one flaw in your code: i will never be equal to array.length inside the loop. You should check against array.length - 1.
And I would move the check against empty input to before the loop. Sure, your loop will end after the first iteration, but it still looks odd.

I also see you ignored my advice on using the other parse method to prevent having to catch parse exceptions.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Code review required for converting dateformat
 
Similar Threads
Parsing error in DaterFormat.parse
Date-time comparison
DateFormatting
Calculate Date having DIFFERENT DATE FORMATS
Months and years