private HoughLine[] getTop(int var1) {
        HoughLine[] var2 = new HoughLine[var1];

        for (int var3 = 0; var3 < var1; ++var3) {
            var2[var3] = new HoughLine();
        }

        int var4;
        int var5;
        for (var4 = 0; var4 < this.cHMatrix.length - 1; ++var4) {
            if (this.cHMatrix[var4] > var2[var1 - 1].count) {
                var2[var1 - 1].count = this.cHMatrix[var4];
                var2[var1 - 1].index = var4;

                for (var5 = var1 - 1; var5 > 0 && var2[var5].count > var2[var5 - 1].count; --var5) {
                    HoughLine var7 = var2[var5];
                    var2[var5] = var2[var5 - 1];
                    var2[var5 - 1] = var7;
                }
            }
        }

        for (int var6 = 0; var6 < var1; ++var6) {
            var5 = var2[var6].index / this.cSteps;
            var4 = var2[var6].index - var5 * this.cSteps;
            var2[var6].alpha = this.getAlpha(var4);
            var2[var6].d = (double) var5 + this.cDMin;
        }

        return var2;
    }
Copied and pasted from Tess4j (https://sourceforge.net/projects/tess4j/)
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/tess4j/ImageDeskew.java