File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code review required for converting dateformat

Rob Spoor
Posts: 20369
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic