Bidi getLevelAt() method in Java with Examples Last Updated : 19 Jan, 2023 Comments Improve Suggest changes Like Article Like Report The getLevelAt() method of java.text.Bidi class is used to provide the resolved level of the particular character present at the particular point on the line of bidi text. Syntax: public int getLevelAt(int offset) Parameter: This method takes offset of the character present of the line of text for which resolved level is needed. Return Value: This method provides the resolved level for a particular character whose offset is given as parameter if the offset is less than zero or greater than the entire length of bidi text then it just returns the equivalent base level. Below are the examples to illustrate the getLevelAt() method: Example 1: Java // Java program to demonstrate // getLevelAt() 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", 0); int offset = 3; // getting resolved level of Character // using getLevelAt() method int status = bidi.getLevelAt(offset); // display the result if (offset > 0 && (bidi.getLength()) > offset) System.out.println( "resolved level of the " + "Character at offset " + offset + " is " + status); else System.out.println( "base direction level is " + status); } } Output:resolved level of the Character at offset 3 is 0 Example 2: Java // Java program to demonstrate // getLevelAt() 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", 0); int offset = -3; // getting resolved level of Character // using getLevelAt() method int status = bidi.getLevelAt(offset); // display the result if (offset > 0 && (bidi.getLength()) > offset) System.out.println( "resolved level of the " + "Character at offset " + offset + " is " + status); else System.out.println( "base direction level is " + status); } } Output:base direction level is 0 Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#getLevelAt-int- Comment More infoAdvertise with us Next Article Bidi getLevelAt() method in Java with Examples R rohitprasad3 Follow Improve Article Tags : Java Java-Functions Java-text package Java-Bidi Practice Tags : Java Similar Reads Bidi getRunLevel() method in Java with Examples The getRunLevel() method of java.text.Bidi class used to provide the level for the nth run of this line of text if there is only one running state then It will provide base level for that state . Syntax: public int getRunLevel(int run) Parameters: This method accepts the index of the logical run for 2 min read Bidi getBaseLevel() method in Java with Examples The getBaseLevel() method of java.text.Bidi class is used to get the base level of this instance of Bidi Class. Base level means whether this Bidi instance has base level "left to right" or "right to left". Syntax: public int getBaseLevel() Parameter: This method accepts nothing as parameter. Return 2 min read Bidi getLength() method in Java with Examples The getLength() method of java.text.Bidi class is used to get the length of the text in this Bidi instance. Syntax: public int getLength() Parameter: This method accepts nothing as parameter. Return Value: This method provides the length of the bidi text as integer. Below are the examples to illustr 2 min read 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 Va 2 min read 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. Retur 2 min read Like