private static long packedCodeSize(IntList cases) {
    int sz = cases.size();
    long low = cases.get(0);
    long high = cases.get(sz - 1);
    long result = ((high - low + 1)) * 2 + 4;

    return (result <= 0x7fffffff) ? result : -1;
  }
Gets the size of a packed table for the given cases, in 16-bit code units.

@param cases {@code non-null;} sorted list of cases
@return {@code >= -1;} the packed table size or {@code -1} if the cases couldn't possibly be
    represented as a packed table
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/SwitchData.java