public static String findLowestTier(String[] tiers) {
    //if only 1 store then you don't need to find the lowest tier
    if (tiers.length == 1) {
      return tiers[0];
    }

    //we expect at least one tier
    if (tiers.length == 0) {
      throw new RuntimeException("No existing tier");
    }

    // We rely here on the alphabetical order matching the depth order so from highest to lowest we have
    // OnHeap, OffHeap, Disk, Clustered
    String lowestTier = tiers[0];
    for (int i = 1; i < tiers.length; i++) {
      if (tiers[i].compareTo(lowestTier) < 0) {
        lowestTier = tiers[i];
      }
    }

    return lowestTier;
  }
public static String findLowestTier ( String [ ] tiers ) { if ( tiers . length == 1 ) { return tiers [ 0 ] ; } if ( tiers . length == 0 ) { throw new RuntimeException ( "No existing tier" ) ; } String lowestTier = tiers [ 0 ] ; for ( int i = 1 ; i < tiers . length ; i ++ ) { if ( tiers [ i ] . compareTo ( lowestTier ) < 0 ) { lowestTier = tiers [ i ] ; } } return lowestTier ; }
Find the lowest tier from a list of tier. We assume a lot of things here that the tiers depth
<strong>magically matches the alphabetical order<strong>.

@param tiers all tiers
@return the lowest tier