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 illustrate the getLength() method:
Example 1:
// Java program to demonstrate// getLength() 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);          // getting the length of line of text        // using getLength() method        int length = bidi.getLength();          // display the result        System.out.println("length of line : "                           + length);    }} |
length of line : 15
Example 2:
// Java program to demonstrate// getLength() 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);          // getting the length of line of text        // using getLength() method        int length = bidi.getLength();          // display the result        System.out.println("length of line : "                           + length);    }} |
length of line : 8
Reference: https://docs.oracle.com/javase/9/docs/api/java/text/Bidi.html#getLength–
