Bidi getRunLimit() method in Java with Examples
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-
Please Login to comment...