Write a Java program with the following functionalities:
It should use a one-dimensional array.
It should enable the user to search for an element in the array.
If the element is found, it should display the number of occurrences.
If the element is not found, an error message should be displayed.