File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Code review required for converting dateformat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
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: 19541
    
  16

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code review required for converting dateformat
 
Similar Threads
Date-time comparison
Calculate Date having DIFFERENT DATE FORMATS
DateFormatting
Parsing error in DaterFormat.parse
Months and years