private void calc() {
        int var1 = (int) ((double) this.cImage.getHeight() / 4.0D);
        int var2 = (int) ((double) this.cImage.getHeight() * 3.0D / 4.0D);
        this.init();

        for (int var3 = var1; var3 < var2; ++var3) {
            for (int var4 = 1; var4 < this.cImage.getWidth() - 2; ++var4) {
                if (ImageUtil.isBlack(this.cImage, var4, var3) &&
                        !ImageUtil.isBlack(this.cImage, var4, var3 + 1)) {
                    this.calc(var4, var3);
                }
            }
        }

    }
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