You should make it into a multi-dimensional array like:
String[][] stockPrice = {
{ "Reliance", "2022-01-01 10:00", "100" },
{ "Reliance", "2022-01-01 10:34", "110" },
{ "Tata", "2022-01-01 10:30", "500" },
{ "Reliance", "2022-03-02 10:15", "120" },
{ "Tata", "2022-01-01 12:00", "400" },
};
You can now process each individual set and calculate the averages by creating a new Map collection for each product name. See
Lesson: Interfaces (The Java™ Tutorials > Collections)[
^].