title: ArrayIndexOutOfBoundsException getting
body: <pre><code>public class CSoftHttpClientSMSService extends SMSService     {
  
      private HttpClient client;    
      //private String mmsServiceUrl = "https://www.csoft.co.uk/sendmms";    
      private String smsServiceUrl = "https://www.csoft.co.uk/sendsms";    
      private String username = "my_username"; //pass the username   
              private String PIN = "my_password"; //pass the pin from the website
  
         //private static Log log = LogFactory.getLog(CSoftHttpClientSMSService.class);
        public CSoftHttpClientSMSService() {
          super();
          client = new HttpClient();
      }  
  
      /* 
       * (non-Javadoc)
       * 
       * @see com.ipanema.support.sms.SMSService#getAccountMessageLimit()
       */
          public int getAccountMessageLimit()     {
              //log.debug("in getMessageLimit");
                  PostMethod method = new PostMethod(smsServiceUrl);
          method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
                  new DefaultHttpMethodRetryHandler(3, false));
          method.setParameter("Username", username);
          method.setParameter("PIN", PIN);
          method.setParameter("AvailableMessages", "");
          String result = new String();
          try {
              result = doHttpServiceRequest(method);
              //log.debug("result is: " + result);
          } catch (Exception e) {
              //log.warn(e.toString());
          }
             String[] retArray = result.split("=");
             return Integer.valueOf(retArray[1]);
      }
  
  
      /*
       * (non-Javadoc)
       * 
       * @see com.ipanema.support.sms.SMSService#getAccountBalanceCurrency()
       */
      public String getAccountBalanceCurrency()     {
          //log.debug("in getAccountBalanceCurrency");
          PostMethod method = new PostMethod(smsServiceUrl);
          //method.getParams().setParameter(HttpMethodParams.COOKIE_POLICY,   new DefaultHttpMethodRetryHandler(3, false));
          method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
          method.setParameter("Username", username);
          method.setParameter("PIN", PIN);
          method.setParameter("AvailableCredit", "");
          String result = new String();
          try {
              result = doHttpServiceRequest(method);
          //  log.debug("result is: " + result);
          } catch (Exception e) {
              //log.warn(e.toString());
          }
          String[] retArray = result.split("=");
          String[] r2 = retArray[1].split(" ");
          return r2[0];
      }
  
      /*
       * (non-Javadoc)
       * 
       * @see com.ipanema.support.sms.SMSService#getAccountBalance()
       */
      public float getAccountBalance()     {
          //log.debug("in getAccountBalance");
          PostMethod method = new PostMethod(smsServiceUrl);    
  
          method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));
          method.setParameter("Username", username);    
          method.setParameter("PIN", PIN);   
          method.setParameter("AvailableCredit", "");   
          String result = new String();   
          try {
              result = doHttpServiceRequest(method);   
          System.out.println("result is: " + result);   
          } catch (Exception e) {  
          //  log.warn(e.toString());   
          }
  
  
          String[] retArray = result.split("=");   
          String[] r2=retArray[1].split(" ");  
          System.out.println("Outside");   
          //return Float.valueOf(r2[0]);    
           return Float.valueOf(retArray[0]);    
  
      }
  
      /*
       * (non-Javadoc)
       * 
       * @see com.ipanema.support.sms.SMSService#sendSimpleSMS(java.lang.String,
       *      java.lang.String)
       */
      public void sendSimpleSMS(String msgTo, String msgBody)     {
          //  log.debug("in sendSimpleSMS");
              PostMethod method = new PostMethod(smsServiceUrl);    
  
              method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false));    
              method.setParameter("Username", username);   
              method.setParameter("PIN", PIN);    
              method.setParameter("SendTo", msgTo);   
              method.setParameter("Message", msgBody);   
      //      System.out.println("done");   
              try {   
                  String result = doHttpServiceRequest(method);   
                  //log.debug("result is: " + result);  
              } catch (Exception e) {   
                  //log.warn(e.toString());
              }
          }
  
  
      private String doHttpServiceRequest(PostMethod method)
              throws HttpException, IOException     {
          //log.debug("in doHttpServiceRequest");
          int statusCode = client.executeMethod(method);   
          if (statusCode != HttpStatus.SC_OK) {
              //log.info("Method failed: " + method.getStatusLine());
          }    
          InputStream is = method.getResponseBodyAsStream();   
          BufferedReader br = new BufferedReader(new InputStreamReader(is));  
          String line = null;
          StringBuffer response = new StringBuffer();  
          while ((line = br.readLine()) != null) {  
              response.append(line);  
          }
          method.releaseConnection();
          return response.toString();
      }
  
      public static void main(String args[])     {
      //  log.debug("in main");
          SMSService sms = new CSoftHttpClientSMSService();   
          sms.getAccountBalanceCurrency();  
          sms.getAccountBalance();  
          int limitBefore = sms.getAccountMessageLimit();  
      //  log.info(limitBefore);
  //      sms.sendWAPPushSMS("+316xxxxxxxx", "http://www.google.com", "subject");   
          sms.sendSimpleSMS("+918867843591", "this is a simple sms. www.google.com www.yahoo.co.uk");
  //      sms.sendFlashSMS("+316xxxxxxxx", "this is a flash message. www.google.com www.yahoo.co.uk");
          int limitAfter = sms.getAccountMessageLimit();
  //      log.info("operation took " + (limitBefore - limitAfter) + " units");   
      }
  
  
  }
  </code></pre>
  
  <p>Here i am getting an Exception.in the code </p>
  
  <pre><code>String[] r2=retArray[1].split(" ");     
  
  System.out.println("Outside");
   return Float.valueOf(retArray[0]);
  </code></pre>
  
  <p>can anyone resolve this issue.
  Thanks in Advance.</p>