Used System.arrayCopy instead of manually copying array.