(isPlusClicked || op == '+'){
long result = 0;
String finaldata = edt.getText().toString();
finaldata = finaldata.replace("(", "");
finaldata = finaldata.replace(")", "");
System.out.println(" the string is now ==== "+edt.getText().toString());
String[] total = finaldata.split("\\+");
System.out.println(" *************** "+total[0] + "************** "+total[1]);
System.out.println(" the index in the string array are ..... "+sb.toString());
ArrayList<String> alvalue = new ArrayList<String>();
System.out.println(" the splited number is ==== "+total[0] +" the second number is "+total[1]);
StringBuilder sb1 = new StringBuilder(edt.getText().toString());
int inc = 0;
for(int i = 0;i<sb1.length() ; i++){
char plus = sb1.charAt(i);
if(plus == '+'){
String[] totaly = finaldata.split("\\+| \\++ | \\+++");
if(inc>=1){
System.out.println(" *******inc value with result is ***************** "+result+"?&&&&&& "+inc);
result = result + Long.parseLong(totaly[inc+1]);
}else if(inc<=0){
result = Long.parseLong(totaly[inc]) + Long.parseLong(totaly[inc+1]);
//double myDouble = new Long(result).doubleValue();
System.out.println(" Second value is---- ---- "+totaly[inc+1]);
}
inc = inc +1;
}
edt.setText("");
edt.setText( String.valueOf(result));
}
}
当我将值设为双倍时,例如:12345678+32164 比它给我的答案:5.12377842E8 并且当我尝试转换为长于 122.81+212.122 时它给出零(0)答案所以请告诉我我做了什么? 为正确答案