Qur'an | Word by Word | Audio | Prayer Times | Android | New : beta.quran.com
__ Sign In

Java API - Bismillah Example


The Java program below shows how to scan the orthography model to find occurrences of bismillahi arahmāni rahīm ("In the name of Allah, the Beneficent, the Merciful"). Nearly all 114 chapters of the Holy Quran are preceded by this phrase. The Chapter.getBismillah() accessor returns the phrase if it is present for a chapter.

The program performs two steps. In step 1, each chapter in the Holy Quran is enumerated. If the chapter does not have a preceding bismillah, then the chapter number is listed. The program also looks for occurrences of the phrase that have a single additional diacritic shadda attached to the first letter. In step 2, the verses of the Quran are scanned to see if they contain the phrase. The second step is performed using Buckwalter transliteration.

Java Example

public class BismillahExample {

    public static void main() {

        // Step #1. Enumerate each chapter.
        for (Chapter chapter : Document.getChapters()) {

            // If this chapter has no bismillah, then list it.
            if (chapter.getBismillah() == null) {
                System.out.println("No bismillah: " + chapter);

            // Otherwise, check if the chapter has a shadda
            // on the first letter, the Ba.
            else if (chapter.getBismillah().getCharacter(0).isShadda()) {
                    System.out.println("Shadda on Ba: " + chapter);

        // Step #2. Search for bismillah in verses.
        for (Verse verse : Document.getVerses()) {
            if (verse.toBuckwalter().contains(
                "bisomi {ll~ahi {lr~aHoma`ni {lr~aHiymi")) {
                    System.out.println("Bismillah in verse " + verse.getLocation());

Program Output

No bismillah: Chapter 1
No bismillah: Chapter 9
Shadda on Ba: Chapter 95
Shadda on Ba: Chapter 97
Bismillah in verse (1:1)
Bismillah in verse (27:30)


The output above shows that two chapters do not have a preceding bismillah (chapters 1 and 9), two chapters have an additional diacritic (95 and 97), and two chapters contain bismillah within their verses (1 and 27). Chapter 27 is preceded by bismillahi but also contains the phrase in verse (27:30), in which Sulayman writes a letter to Bilqis, the Queen of Sheba. The results show that there are 114 chapters, and 114 occurrences of the phrase within the Holy Quran.

See Also

Language Research Group
University of Leeds