24 lines
758 B
Java
24 lines
758 B
Java
package sum;
|
|
|
|
/**
|
|
* @author Nikita Doschennikov (me@fymio.us)
|
|
*/
|
|
public class SumDouble {
|
|
public static void main(String[] args) {
|
|
double res = 0.0; // 0_0
|
|
for (String arg : args) {
|
|
StringBuilder builder = new StringBuilder();
|
|
for (char c : arg.toCharArray()) {
|
|
if (!Character.isWhitespace(c)) {
|
|
builder.append(c);
|
|
} else {
|
|
res += (!builder.toString().isEmpty()) ? Double.parseDouble(builder.toString()) : 0;
|
|
builder = new StringBuilder();
|
|
}
|
|
}
|
|
res += (!builder.toString().isEmpty()) ? Double.parseDouble(builder.toString()) : 0;
|
|
}
|
|
System.out.println(res);
|
|
}
|
|
}
|