i was reading into this thread Removing an element from an Array (Java) And saw you could use ArrayUtils but i am unsure how?
This is the code so far
package javatesting;
import static java.lang.System.*;
public class main
}
public static int countIt( int[] iRay, int val )
{
int count = 0;
for(int item : iRay)
{
if( item == val )
{
count = count + 1;
}
}
return count;
}
public static int[] removeIt( int[] iRay, int val )
{
return null;
}
public static void printIt( int[] iRay )
{
for(int item : iRay)
{
out.print(item + " ");
}
}
public static void main(String[] args)
{
int[] nums = {7,7,1,7,8,7,4,3,7, 9,8};
printIt( nums );
System.out.println("\ncount of 7s == " + countIt( nums, 7 ));
nums = removeIt( nums, 7 );
printIt( nums );
System.out.println("\ncount of 7s == " + countIt( nums, 7 ));
}
I tryed placing it in removeIt but i dont understand how it should connect? My AP Teacher didnt explain it to us If possible could one of you link me a tutorial for java As i understand it asks for the count of non sevens that why i want ot create a array with the seven's removed using the ArrayUtils (i am using eclipse if it matters)