# For the string, product of all digits: 2 @ 2 @ 3 @ 13

2@2@3@13
2@2@3@4@13

If solving the above string, product of all digital part.
For example: 2@2@3@13

2 * 2 * 3 * 13 = 156

Product of all digital part. 13 should be seen as a whole, rather than the 1 and 3

Online, thank you master.

Started by Leopold at February 02, 2016 - 5:56 PM

```
String str = "2@2@3@13";
String[] data = str.split("@");
BigInteger bi = new BigInteger("1");
for(int i = 0; i <data.length; ++i){
bi = bi.multiply(new BigInteger(data[i]));
}
System.out.println(bi);
```

Posted by Emmanuel at February 10, 2016 - 6:47 PM

Positive solutions of ~ ~ ~ ~ but why use the integer? Convert integer data ordinary can. .

Posted by Gillian at February 22, 2016 - 7:03 PM

Look at the others answer I can also learn a lot of things,

Posted by Augustine at February 23, 2016 - 8:02 PM

Sure. But the big integer higher accuracy, it is said that if the memory support, how many digits can represent

Posted by Olina at March 04, 2016 - 8:54 PM

The landlord, hello. Upstairs said is right

Posted by Dominic at November 16, 2016 - 1:23 PM

We can roughly estimate, product size, generally do not involve multi factorial integer can cope with.

Posted by Martha at November 24, 2016 - 1:25 PM

```public static void main(String[] args) throws ScriptException {
String s = "2@2@3@13";
s = s.replaceAll("@", "*");
ScriptEngineManager fac = new ScriptEngineManager();
ScriptEngine engine = fac.getEngineByName ("JavaScript");
Object o = engine.eval(s);
System.out.println(o);
}
```

Posted by Justin at December 08, 2016 - 1:35 PM

This can be

Posted by Adolph at December 15, 2016 - 1:52 PM

import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.script.ScriptEngine;
public class TestString{

public static void main(String[] args) throws ScriptException {
String s = "2@2@3@13";
s = s.replaceAll("@", "*");
ScriptEngineManager fac = new ScriptEngineManager();
ScriptEngine engine = fac.getEngineByName ("JavaScript");
Object o = engine.eval(s);
System.out.println(o);
}
}

Posted by Adolph at December 18, 2016 - 2:47 PM

Upstairs to say there are problems
Because of neglect of the 2@@3 problem, and other non numeric characters, and minus
```String str = "@2.1@2-6@@-11.@4";

int len = str.length();

boolean newElement = false, nag = false;

for(int i = 0; i <len; i++) {
char ch = str.charAt(i);

if(ch >= '0' && ch <= '9') {
int num = ch - 48;

if(list.isEmpty()) {
} else {
if(newElement) {
} else {
int first = list.removeFirst();
if(nag) {
if(first == '-') {
} else {
}
} else {
}
}
}
newElement = false;
} else if(ch == '-') {
if(newElement) {
nag = true;
newElement = false;
} else {
newElement = true;
}
} else {
newElement = true;
nag = false;
}
}

System.out.println(list);

int t = 1;

for(int i : list) {
t *= i;
}

System.out.println(t);```

Posted by Edwin at December 28, 2016 - 3:05 PM

Print digital above in reverse and results
[4, -11, 6, 2, 1, 2]
-1056

Posted by Edwin at January 08, 2017 - 4:58 PM

This topic, what technical content, you might as well ask expression evaluation 3+5*(5+3)=?
split("\\D+"),To all non digital separated

Posted by Gregary at January 12, 2017 - 4:02 PM