Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Number Format exception in android

Hi in the below code i have one string variable.I want to convert that string into integer of arrays.

Am just trying with my code but it is not working .Am getting an issue

Number Format exception:"["

    String cct =  "["+ cct1 + " " + cct2 + " " + cct3 + " " + cct4 + " " + cct5 + " " + cct6 + " " + cct7 + " " + cct8 + " " + cct9 + " " + cct10 + " " + cct11 + " " + cct12 + "]";
    String intensity =  "["+ intensity1 + " " + intensity2 + " " + intensity3 + " " + intensity4 + " " + intensity5 + " " + intensity6 + " " + intensity7 + " " + intensity8 + " " + intensity9 + " " + intensity10 + " " + intensity11 + " " + intensity12 + "]";

    number =new int[cct.length()];
    try{
        for(int i=0;i<cct.length();i++){
            number[i] = Integer.parseInt(String.valueOf(cct.charAt(i)));
        }
    }catch(NumberFormatException ex){ // handle your exception
      ex.printStackTrace();
    }
    cctvalues =new int[intensity.length()];
    try{
        for(int i=0;i<intensity.length();i++){
            cctvalues[i]=Integer.parseInt(String.valueOf(intensity.charAt(i)));
    } catch (...) {
        ...
    }

Expected output: [10,30,40,50,60,70,78,89,80] like this

Comments