To write a Java program that returns the mode of an array, the discussion emphasizes understanding the concept of mode as the element with the highest frequency. A suggested approach involves counting frequencies of elements, which can be done without sorting the array, potentially achieving O(n) time complexity. While sorting the array is a common method, it typically operates in O(n log n) time. The conversation highlights the importance of first determining the mode correctly before optimizing for efficiency. The code snippets provided illustrate attempts to implement frequency counting and sorting, with considerations for handling various integer ranges. The discussion also hints at alternative methods for specific data types, suggesting that knowing the nature of the data can lead to more efficient solutions.