Java Utililty Methods BigDecimal Encode

List of utility methods to do BigDecimal Encode

Description

The list of methods to do BigDecimal Encode are organized into topic(s).

Method

voidencodeImage(BufferedImage bufferedImage, File file)
encodes as a .jpg a given BufferedImage
try {
    ImageIO.write(bufferedImage, "jpg", file);
} catch (IOException e) {
    JOptionPane.showMessageDialog(null, "Sorry, an error has occured : " + e);
byte[]encodePackedBCD(BigDecimal v, int decimals, int length)
Convert from BigDecimal to packed BCD.
long v2 = v.scaleByPowerOfTen(decimals).longValue();
byte[] res = new byte[length];
int low = 12;
if (v2 < 0) {
    low = 13;
    v2 = -v2;
int high = (int) (v2 % 10);
...
StringencodeRealNumberRange(BigDecimal number, int maxNumDigits, BigDecimal offsetValue)
encode Real Number Range
BigDecimal offsetNumber = number.add(offsetValue);
String longString = offsetNumber.toString();
int numZeroes = maxNumDigits - longString.length();
StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
for (int i = 0; i < numZeroes; i++) {
    strBuffer.insert(i, '0');
strBuffer.append(longString);
...
StringencodeRealNumberRange(BigDecimal number, int maxNumDigits, BigDecimal offsetValue)
encode Real Number Range
final BigDecimal offsetNumber = number.add(offsetValue);
final String longString = offsetNumber.toString();
final int numZeroes = maxNumDigits - longString.length();
final int paddedSize = numZeroes + longString.length();
final StringBuilder strBuffer = new StringBuilder(paddedSize);
for (int i = 0; i < numZeroes; i++) {
    strBuffer.insert(i, '0');
strBuffer.append(longString);
return strBuffer.toString();