Beginner programmer here, I currently have a program written up that takes an array and a variable and compares the two, if the variable declared is within the array, the array will print out all the numbers within the array besides the number contained in the variable. This is working and functioning properly. Furthermore, what I would like to do now is take the code I've written up and put it in a functioning method for reuse but I am currently kind of stuck on doing so. The end result would be having the a new smaller array displayed that does not contain the number 17 anymore. Here is my code example.
public class arrayTest
{
public static void main(String [] args)
{
int[]arrayA = {2,4,8,19,32,17,17,18,25,17};
int varB = 17;
for(int B = 0; B < arrayA.length; B++)
{
if(arrayA[B] != varB)
{
System.out.print(arrayA[B] + " ");
}
}
}
public static int newSmallerArray( int[] A, int b )
{
}
}