java保留两位小数
/**
* 保留两位小数
* @param d
* @return
*/
private static double remainTwoNumbers(double d){
java.math.BigDecimal f1 = new java.math.BigDecimal(d);//小数点后保留2位,4舍5入
f1 = f1.setScale(2,java.math.BigDecimal.ROUND_HALF_UP);
return f1.doubleValue();
}
相关文档:
public static void getSysProp(){
Properties props = System.getProperties();
Set<Entry<Object,Object>> res = props.entrySet();
Iterator it = res.iterator();
while (it.hasNext())
{
Map.Entry e = (Map.Entry)it.next();
......
public class testthree {
public static void main(String[] args) {
testthree t = new testthree();
t.test();
}
private static void test() {
int d = 0;
int f = 4;
int x = 0;
int y = 6;
for (i ......
/*内部类使用示例*/
package demo;
class Outer{
int outer_i=100;
static int outer_j=200;
final int outer_k=300;
void test(){
Inner in = new Inner();
in.display();
}
static class Inner{
void display(){
  ......
package demo;
class InOut{
String str=new String("Between");
static int i=666;
int j=888;
final int k=999;
public void amethod(final int iArgs){
int it315;
final int x=111;
/*static*/ class Bicycle
{
//&n ......
我们知道栈是一种先进后出的数据容器。当一个栈的输入序列是递增序列(例如a,b,c,d),并且在进栈操作时,允许退栈操作,则输出的序列可能有多种形式(例如:d,c,b,a或a,c,b,d等)。但是却肯定不会出现如下出栈序列:a,d,b,c或d,a,b,c等。在输入序列为递增序列的假设下,请编写一个算法判断输入的字符串表示的出栈序列是否为 ......