Open In App
Related Articles

Bidi getRunLimit() method in Java with Examples

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
The getRunLimit() method of java.text.Bidi class is used to provide the (index +1) value of the last character where the last run ends of this Bidi instance. Syntax:
public int getRunLimit(int run)
Parameters: This method accepts the index of the run for which Run limit is to be retrieved. Return Value: This method provides the length of the line for the last run. Below are the examples to illustrate the getRunLimit() method: Example 1:
// Java program to demonstrate
// getRunLimit() method
  
import java.text.*;
import java.util.*;
import java.io.*;
  
public class GFG {
    public static void main(String[] argv)
    {
        // creating and initializing Bidi
        Bidi bidi = new Bidi("Tajmahal", 1);
  
        int index = 1;
  
        // getting the last character of indexed run
        // using getRunLimit() method
        int level = bidi.getRunLimit(index);
  
        // display the result
        System.out.println(
            "level of first run is : "
            + level);
    }
}

                    
Output:
level of first run is : 8
Example 2:
// Java program to demonstrate
// getRunLimit() method
  
import java.text.*;
import java.util.*;
import java.io.*;
  
public class GFG {
    public static void main(String[] argv)
    {
        // creating and initializing Bidi
        Bidi bidi = new Bidi("Geeks for Geeks", 1);
  
        int index = 1;
  
        // getting the last character of indexed run
        // using getRunLimit() method
        int level = bidi.getRunLimit(index);
  
        // display the result
        System.out.println(
            "level of first run is : "
            + level);
    }
}

                    
Output:
level of first run is : 15
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#getRunLimit-int-

Last Updated : 27 Nov, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads