Here you can find the source of sumListItems(List list)
public static String sumListItems(List list)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static String sumListItems(List list) { double sum = 0d; for (int i = 0; i < list.size(); i++) { String value = (String) list.get(i); if (value == null || "".equals(value)) continue; sum = sum + Double.parseDouble(value); }//from w ww .j a v a 2 s . co m return String.valueOf(sum); } public static String valueOf(char c) { char ac[] = new char[1]; ac[0] = c; return new String(ac); } public static String valueOf(double d) { return Double.toString(d); } public static String valueOf(float f) { return Float.toString(f); } public static String valueOf(int i) { char ac[] = new char[11]; int j = ac.length; boolean flag = i < 0; if (!flag) i = -i; for (; i <= -10; i /= 10) ac[--j] = Character.forDigit(-(i % 10), 10); ac[--j] = Character.forDigit(-i, 10); if (flag) ac[--j] = '-'; return new String(ac, j, ac.length - j); } public static String valueOf(long l) { return Long.toString(l, 10); } public static String valueOf(Object obj) { return obj != null ? obj.toString() : ""; } public static String valueOf(boolean flag) { return flag ? "true" : "false"; } public static String valueOf(char ac[]) { return new String(ac); } }