After considering your String
It made me to add one thing
String s2= "10 = On Battery ";
String s[]=s2.split("=");
int i=Integer.parseInt(s[0].trim());<-----------
use trim() otherwise you will have "10 " with whitespace
^
But......
I have to split the numeric value 10 and words "On Battery"(Including the space in between them)
String a=s2.split("=")[0];//"10 "
String b=s2.split("=")[1];//" On Battery "