java arrayoutofbound exception after compiling : <pre><code>package binarywa;
import java.util.*;

public class binaryadd {
    public static void main(String args[])
    {
        Scanner scan=new Scanner(System.in);
        String g=scan.next();
        String s[]=g.split("");
        int i,x=0;


        for(i=s.length;i&gt;0;i--)
        {

         x+=Integer.parseInt(s[i])*Math.pow(2,i);
         }  

    }

}
</code></pre>

<p>Im trying to convert binary into decimal</p>

<p>but after compiling this im getting an arrayoutofbound exception</p>

<p>eg:
541656(its the input)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
    at binarywa.binaryadd.main(binaryadd.java:16)</p>
