Java BigDecimal printGainHTML(BigDecimal gain)

Here you can find the source of printGainHTML(BigDecimal gain)

Description

print Gain HTML

License

Open Source License

Declaration

public static String printGainHTML(BigDecimal gain) 

Method Source Code

//package com.java2s;
// All Rights Reserved * Licensed Materials - Property of IBM

import java.math.BigDecimal;

public class Main {
    public final static int ROUND = BigDecimal.ROUND_HALF_UP;
    public final static int SCALE = 2;

    public static String printGainHTML(BigDecimal gain) {
        String htmlString, arrow;
        if (gain.doubleValue() < 0.0) {
            htmlString = "<FONT color=\"#ff0000\">";
            arrow = "arrowdown.gif";
        } else {//from  ww  w.j a v  a  2  s.c om
            htmlString = "<FONT color=\"#009900\">";
            arrow = "arrowup.gif";
        }

        htmlString += gain.setScale(SCALE, ROUND) + "</FONT><IMG src=\"images/" + arrow
                + "\" width=\"10\" height=\"10\" border=\"0\"></IMG>";
        return htmlString;
    }
}

Related

  1. percentage(BigDecimal bd)
  2. percentChange(BigDecimal oldValue, BigDecimal newValue)
  3. percentOf(BigDecimal fullAmount, int percentToKeep)
  4. percentToFactor(BigDecimal percent)
  5. printBigDecimal(BigDecimal decimal)
  6. putBigDecimal(byte[] bytes, int offset, BigDecimal val)
  7. randomBigDecimal()
  8. randomBigDecimalList(BigDecimal min, BigDecimal max, int minLength, int maxLength)
  9. rangedValue(BigDecimal lower, BigDecimal upper, Random random)