Because the project needs to configure a refresh time in the configuration file, the data taken out of the configuration file is definitely a string, and then the string with the operator is converted to a long type. The specific code is as follows:
In configuration file system.properties:
1 reflash_time = (2*60*1000)
The Java code takes out the value:
1 Public Static Final String reflashtime = "Reflash_time"; 2 3 Public String reflashtime; 4 5 reflashtime = Prop.getproperty (reflashtime). Trim ();
The string is split by *, the number is saved in an array, and then multiplied to get its value:
1 string[] Reflash = Reflashtime.split ("\\*"2 3 for (int i = 0; i < reflash.length; i++) {4 reflashtime *= long.parselong (Reflash[i]); 5 }6 7 System.out.println (reflashtime);
This enables the conversion of a string with an operator to an integral type.
Java string with operator is converted to long type