Here you can find the source of sumandsub(String[] X)
static public String sumandsub(String[] X)
//package com.java2s; //License from project: Apache License public class Main { static public String sumandsub(String[] X) { double x = 0; double y = 0; for (int i = 0; i < X.length; i++) { if (X[i].startsWith("-")) x += Double.valueOf(X[i]); /*x+=Double.parseDouble(X[i]);*/ else// w w w . ja va2 s .c o m y += Double.valueOf(X[i]); /*y+=Double.parseDouble(X[i]);*/ } double z = x + y; String pop = Double.toString(z); return pop; } }