Last active
May 16, 2020 14:28
-
-
Save dan-dm/72e500688d2a6442685b2a635be42e6a to your computer and use it in GitHub Desktop.
Created with Copy to Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] addOneIntToArray(int[] initialArray , int newValue) { | |
int[] newArray = new int[initialArray.length + 1]; | |
for (int index = 0; index < initialArray.length; index++) { | |
newArray[index] = initialArray[index]; | |
} | |
newArray[newArray.length - 1] = newValue; | |
return newArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment