Friday, October 10, 2025
HomeLanguagesJavaBidi getRunStart() method in Java with Examples

Bidi getRunStart() method in Java with Examples

The getRunStart() method of java.text.Bidi class used to provide the index of the first character where the nth run starts for this Bidi instance.

Syntax:

public int getRunStart(int run)

Parameters: This method accepts the index of the logical run for which start of the run is to be retrieved.

Return Value: This method provides the index of start character for the nth logical run.

Below are the examples to illustrate the getRunStart() method:

Example 1:




// Java program to demonstrate
// getRunStart() method
  
import java.text.*;
import java.util.*;
import java.io.*;
  
public class GFG {
    public static void main(String[] argv)
    {
        // creating and initializing Bidi
        // with base direction
        Bidi bidi = new Bidi("Tajmahal", 0);
  
        int index = 0;
  
        // getting the start of run for the index 0
        // using getRunStart() method
        int level = bidi.getRunStart(index);
  
        // display the result
        System.out.println(
            "start of run for index 0 is : "
            + level);
    }
}


Output:

start of run for index 0 is : 0

Example 2:




// Java program to demonstrate
// getRunStart() method
  
import java.text.*;
import java.util.*;
import java.io.*;
  
public class GFG {
    public static void main(String[] argv)
    {
        // creating and initializing Bidi
        // with base direction
        Bidi bidi
            = new Bidi("Geeks for Geeks", 1);
  
        int index = 0;
  
        // getting the start of run for the index 0
        // using getRunStart() method
        int level = bidi.getRunStart(index);
  
        // display the result
        System.out.println(
            "start of run for index 0 is : "
            + level);
    }
}


Output:

start of run for index 0 is : 0

Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#getRunStart-int-

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32349 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6717 POSTS0 COMMENTS
Nicole Veronica
11880 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6838 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6792 POSTS0 COMMENTS
Umr Jansen
6792 POSTS0 COMMENTS