Is there a way to find the length of a variable in Java? : <pre><code>long AccountNumber = 1234567890;
public void setAccNum(long Number)
    try(the size of the account number is lesser than equal to 10){
        this.Accountnumber = Number;
    }
    catch(Exception e){
        System.out.println("Error: Invalid account number");
    }
</code></pre>

<p>In the above code, to validate the length of the account number, is there any function to find the length of the value in AccountNumber variable in Java?</p>
