Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 11, Size: 11
<p>This crawling program is getting out of bounds exception
how to fix it?</p>
<blockquote>
<p>Exception in thread &quot;main&quot; java.lang.IndexOutOfBoundsException: Index:
11, Size: 11  at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)  at
Glowship_inv_battery.main(Glowship_inv_battery.java:68)</p>
</blockquote>
<p>Code:</p>
<pre><code>import java.util.ArrayList;

import com.webscrap4j.WebScrap;
import com.webscrap4j.WebScrapException;

import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
  
public class letsbuybattery_inverterbattery 
{
    @SuppressWarnings(&quot;resource&quot;)
    public static void main(String[] args) throws IOException {
    
        ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;();
        ArrayList&lt;String&gt; bl = new ArrayList&lt;String&gt;();
        ArrayList&lt;String&gt; cl = new ArrayList&lt;String&gt;();
        WebScrap ws = new WebScrap();
        
        ws.setUrl(&quot;http://letsbuybattery.com/inverters/&quot;);
        try
        {               
            ws.startWebScrap();
            
            al = ws.getSingleHTMLScriptData(&quot;&lt;h5&gt;&quot;, &quot;&lt;/h5&gt;&quot;);
            //mrp
            bl = ws.getSingleHTMLScriptData(&quot;&lt;div class='clearfix'&gt; &quot;, &quot;&lt;/div&gt;&quot;);
            //selling price
            cl = ws.getSingleHTMLScriptData(&quot;&lt;div class='item-price pull-left'&gt;&quot;, &quot;&lt;/div&gt;&quot;);                
            
            HSSFWorkbook workBook = new HSSFWorkbook();
             FileOutputStream fos = new FileOutputStream(&quot;/Users/parthpatil/Documents/Abm Technologies/Crawl/letbuybattery_battery.xls&quot;); 
             {

            // Create the Sheet
            HSSFSheet Sheet = workBook.createSheet(&quot;products&quot;);

            // Create the first row corresponding to the header
            Row header = Sheet.createRow(0);
            header.createCell(0).setCellValue(&quot;Product Name&quot;);
            header.createCell(1).setCellValue(&quot;Product Price&quot;);
            header.createCell(2).setCellValue(&quot;Product MRP&quot;);

            // Ensure that all the List have the same size otherwise throw an exception
            //  if (al.size() != bl.size() || al.size() != cl.size())
            //    throw new IllegalStateException(&quot;Some data is missing&quot;);

            // Iterate over all the list an create the rows of data
            for(int i = 0; i &lt; al.size(); i++){
                // Create the current starting from 1 to al.size()
                HSSFRow row = Sheet.createRow((short) i + 1);
                // Cell of the Product Name
                row.createCell(0).setCellValue(al.get(i));
                // Cell of the Product Price
                row.createCell(1).setCellValue(cl.get(i));
                // Cell of the Product MRP
                row.createCell(2).setCellValue(bl.get(i));
                
            }
            // Write the result into the file
            workBook.write(fos);
            
            for (String adata : al)
            {    
                System.out.println(&quot;the product are:- &quot; + adata);    
            }

            for (String bdata : bl)
            {
                System.out.println(&quot;the MRp are:- &quot; + bdata);    
            }

            for (String cdata : cl)
            {    
                System.out.println(&quot;the selling price is:- &quot; + cdata);    
            }               
        }
             }catch (WebScrapException e) {
            
            e.printStackTrace(System.out);
        }
        }
    }
</code></pre>