Skip to main content


System.arraycopy() vs. Arrays.copyOf() in Java


System.arraycopy() vs. Arrays.copyOf() in Java If we want to copy an array, we can use either System.arraycopy() or Arrays.copyOf(). In this post, I use a simple example to demonstrate the difference between the two. 1. Simple Code Examples System.arraycopy() int[] arr ={1,2,3,4,5};int[] copied =newint[10];System.arraycopy(arr, 0, copied, 1, 5);//5 is the length to copySystem.out.println(Arrays.toString(copied)); Output: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 2, 3, 4, 5, 0, 0, 0, 0] Arrays.copyOf() int[] copied =Arrays.copyOf(arr, 10);//10 the the length of the new arraySystem.out.println(Arrays.toString(copied));   copied =Arrays.copyOf(arr, 3);System.out.println(
Recent posts

Sublime 3 - useful keyboard shortcuts

source #1:
source #2:
Ctrl + D
Select a word.

Ctrl + L
Select a line.

Ctrl + A
Select the entire content within the document.

Ctrl + Shift + M
Select anything inside the bracket (which is useful when working with CSS or JavaScript)

Furthermore, Sublime Text brings lets us select multiple lines at once, which can significantly boost your productivity. There are several ways to perform this feature:


Hold the Ctrl key and click on the lines that you want to select.

Ctrl + Shift + G
Select a code, line, or word first the hit this combo to select the others with the same instances.

Ctrl + D
Hit this key to quickly select the next code, line, or word that has the same instances as you are currently selecting.

Spring boot Common application properties
# ===================================================================# COMMON SPRING BOOT PROPERTIES## This sample file is provided as a guideline. Do NOT copy it in its# entirety to your own application. ^^^# ===================================================================# ----------------------------------------# CORE PROPERTIES# ----------------------------------------# BANNERbanner.charset=UTF-8 # Banner file encoding.banner.location=classpath:banner.txt # Banner file location.banner.image.location=classpath:banner.gif # Banner image file location (jpg/png can also be used).banner.image.width= # Width of the banner image in chars (default 76)banner.image.height= # Height of the banner image in chars (default based on image height)banner.image.margin= # Left hand image margin in chars (default 2)banner.image.invert= # If images should be inverted for dark terminal theme…