I have an array of strings that have 3 subsections that I am looking to sort. See the below example
String[] teams = new String[5];
teams[0] = "Header1";
teams[1] = "Candy";
teams[2] = "Apples";
teams[3] = "Fruit";
teams[4] = "Header2";
teams[5] = "Candy";
teams[6] = "ZZZ";
teams[7] = "Fruit";
teams[8] = "E";
teams[9] = "Header3";
teams[10] = "C";
teams[11] = "T";
teams[12] = "A";
I want to sort each of the subsections while leaving the Headers1-3 in place. Should I break up my array into 3 sub arrays based off of the known entries (Headers1-3) and just use array.sort or is there an easier way that I am unaware of? Note my string array is a fixed length of entries and each Header is in a known position (i.e Header 2 is always in position 4).