Cast an Object To Long in Java
<p>I am trying to convert a Object type to Long type in Java and I got as:</p>

<pre><code>public static Long castObjectToLong(Object object) {
    return ((Long)object).longValue();
</code></pre>

<p>When I run, it throws ClassCastException</p>