2011-02-15 3 views
0
  1. 다음 문자열 출력을 BigDecimal로 변환하려면 어떻게해야합니까? ireport에서 문자열을 bigdecimal로 변환합니다.

    new java.text.DecimalFormat("#,##0.00").format(
        new Double((
        $V{xHrAdm}.doubleValue()*$V{xHrAdm}.doubleValue() + 
        $V{xFodaBnB}.doubleValue()*$V{xFodaBnB}.doubleValue() + 
        $V{xChem}.doubleValue()*$V{xChem}.doubleValue() + 
        $V{xSCMnQA}.doubleValue()*$V{xSCMnQA}.doubleValue() + 
        $V{xPCO}.doubleValue()*$V{xPCO}.doubleValue() + 
        $V{xComp.Eng}.doubleValue() * $V{xComp.Eng}.doubleValue())/6)) 
    
  2. 는 또한 위의 표현

답변

0

1) 왜 BigDecimal를 먼저 한 다음 문자열로 변환해야합니까의 제곱근을 줄까?

new BigDecimal(
$V{xHrAdm}.doubleValue()*$V{xHrAdm}.doubleValue() + 
$V{xFodaBnB}.doubleValue()*$V{xFodaBnB}.doubleValue() + 
$V{xChem}.doubleValue()*$V{xChem}.doubleValue() + 
$V{xSCMnQA}.doubleValue()*$V{xSCMnQA}.doubleValue() + 
$V{xPCO}.doubleValue()*$V{xPCO}.doubleValue() + 
$V{xComp.Eng}.doubleValue() * $V{xComp.Eng}.doubleValue())/6) 

을 그리고 셀에 서식을 적용 :이 같은 double constructor을 사용하여 BigDecimal를로 직접 변환 할 수 있습니다.

new BigDecimal(
Math.sqrt(
$V{xHrAdm}.doubleValue()*$V{xHrAdm}.doubleValue() + 
$V{xFodaBnB}.doubleValue()*$V{xFodaBnB}.doubleValue() + 
$V{xChem}.doubleValue()*$V{xChem}.doubleValue() + 
$V{xSCMnQA}.doubleValue()*$V{xSCMnQA}.doubleValue() + 
$V{xPCO}.doubleValue()*$V{xPCO}.doubleValue() + 
$V{xComp.Eng}.doubleValue() * $V{xComp.Eng}.doubleValue())/6)) 
:

2. )는이 같은 sqrt method of the Math class를 사용할 수의 제곱근을 얻으려면

관련 문제