v7/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextViewAutoSizeHelper.java
private int findLargestTextSizeWhichFits(RectF availableSpace) {
        final int sizesCount = mAutoSizeTextSizesInPx.length;
        if (sizesCount == 0) {
            throw new IllegalStateException("No available text sizes to choose from.");
        }

        int bestSizeIndex = 0;
        int lowIndex = bestSizeIndex + 1;
        int highIndex = sizesCount - 1;
        int sizeToTryIndex;
        while (lowIndex <= highIndex) {
            sizeToTryIndex = (lowIndex + highIndex) / 2;
            if (suggestedSizeFitsInSpace(mAutoSizeTextSizesInPx[sizeToTryIndex], availableSpace)) {
                bestSizeIndex = lowIndex;
                lowIndex = sizeToTryIndex + 1;
            } else {
                highIndex = sizeToTryIndex - 1;
                bestSizeIndex = highIndex;
            }
        }

        return mAutoSizeTextSizesInPx[bestSizeIndex];
    }
/**
     * Performs a binary search to find the largest text size that will still fit within the size
     * available to this view.
     */
Performs a binary search to find the largest text size that will still fit within the size
available to this view.
Performs a binary search to find the largest text size that will still fit within the size available to this view .
private int findLargestTextSizeWhichFits(RectF availableSpace) {
        final int sizesCount = mAutoSizeTextSizesInPx.length;
        if (sizesCount == 0) {
            throw new IllegalStateException("No available text sizes to choose from.");
        }
        int bestSizeIndex = 0;
        int lowIndex = bestSizeIndex + 1;
        int highIndex = sizesCount - 1;
        int sizeToTryIndex;
        while (lowIndex <= highIndex) {
            sizeToTryIndex = (lowIndex + highIndex) / 2;
            if (suggestedSizeFitsInSpace(mAutoSizeTextSizesInPx[sizeToTryIndex], availableSpace)) {
                bestSizeIndex = lowIndex;
                lowIndex = sizeToTryIndex + 1;
            } else {
                highIndex = sizeToTryIndex - 1;
                bestSizeIndex = highIndex;
            }
        }
        return mAutoSizeTextSizesInPx[bestSizeIndex];
    }
private int findLargestTextSizeWhichFits ( RectF availableSpace ) { final int sizesCount = mAutoSizeTextSizesInPx . length ; if ( sizesCount == 0 ) { throw new IllegalStateException ( "No available text sizes to choose from." ) ; } int bestSizeIndex = 0 ; int lowIndex = bestSizeIndex + 1 ; int highIndex = sizesCount - 1 ; int sizeToTryIndex ; while ( lowIndex <= highIndex ) { sizeToTryIndex = ( lowIndex + highIndex ) / 2 ; if ( suggestedSizeFitsInSpace ( mAutoSizeTextSizesInPx [ sizeToTryIndex ] , availableSpace ) ) { bestSizeIndex = lowIndex ; lowIndex = sizeToTryIndex + 1 ; } else { highIndex = sizeToTryIndex - 1 ; bestSizeIndex = highIndex ; } } return mAutoSizeTextSizesInPx [ bestSizeIndex ] ; }
Performs a binary search to find the largest text size that will still fit within the size
 available to this view.
Performs a binary search to find the largest text size that will still fit within the size available to this view .