This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Ive seen some codes in some posts about writing padded Strings to the db file and most of them use the System.arraycopy.. Now im worried that my code below is not efficient as compared to the others. Is my code ok?
Well, I understood the code within 30 secs and when you write documentation for the method, I would have been even faster. My assignment - as well as my experience - says you should prefer clarity over minor speed improvments. The code is readable, so it is ok. If you are really concerned about speed, I would take a profiler and fix hotspots first.