Java String.substring returning empty string
<p>I'm trying to run the following code</p>

<pre><code>int[] sbox = new int[256];
String inputString = "Thisisanexample";
String sTemp;
char cTmp;
int intLength = inputString.length();

for (a = 0; a &lt;= 255; a++)
{
    sTemp = inputString.substring(a % intLength, 1);
    ctmp = sTemp.toCharArray()[0];
    sbox[a] = (int)ctmp;
}
</code></pre>

<p>Every time i run the code I get a java.lang.ArrayIndexOutOfBoundsException when the counter variable = 1.  Checking the code in the debugger, it appears the substring is returning an empty string when it should be returning the second character in the inputString.</p>

<p>Can anyone advise why this would be the case?</p>
