This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Stop using the check style tool.
Use System.arraycopy, which is specially optimised and may be faster than your loop. That is actually a good suggestion from the check style tool.
But remember, check style warnings are only suggestions, which you are not obliged to follow.
By the way, it’s not arrayCopy. Please always use copy-and-paste as suggested here, which is more accurate (and faster) than copying error messages by hand.
Read the documentation and try it. If you still have problems, come back with what you tried and explain the problems you're having. This site is NotACodeMill (←click).
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Joined: Mar 05, 2008
Actually, now that I look at what's being "copied", I don't think it's possible - you're changing the values as they're "copied", so they aren't really copied, so System.arraycopy() won't work. I suggest disabling the inspection, at least for this particular bit of code, or just ignoring it.