needs to be in java
For this program you are to complete the methods given to you to implement a bag (data . structure) using an array. A bag is an unordered collection of values that can have duplicate values. Your task is to fill in the implementation of the methods that manipulates an array of integers.. We have provided a main method in the Main class that tests some of your methods. We will, not be grading the main method in this assignment. Do not have any extraneous print statements in your program, including error messages. Your program should print out exactly what is specified and nothing else. (If the comment prefixing a method does not mention printing, the method should not print anything.) Adds an element to the bag into the first (smallest index) empty location. If the bag is full then print an error message. public static void add(int item, int bag[]) \{\} /** Removes all elements, with the specified value, from the bag. Print an error message if the bag is empty or if the specified item is not in the bag.\% public static void remove(int item, int bag[]) \{\} / Removes all elements from the bag. */ public static void reset(int bag[]) \{\} /** Counts and returns the frequency of the specified item in the bag. * public static int getFrequency(int item, int bag[]) \{\} /** Prints all elements in the bag. */ public static void display(int bag[]) \{\} output should be: 1 Bag: 000000 2 Can not remove an item from an empty bag. 3 Bag: 10000 4 Bag: 12000 5 Bag: 128300 6 Bag: 12340 7 Bag: 12040 8 Bag: 12540 9 Item not found in the bag. Nothing removed 10Bag: 12546 11 Can not add an item to a full bag. 12Bag: 12546 13 Bag: 12540 14 Bag: 125541 15 Bag: 02540 16 Bag: 00000 17 Can not remove an item from an empty bag. 18 There are 5 zeroes