Gráficos dinâmicos em Java

Olá pessoal,

preciso trabalhar com gráficos de barras dinâmicos em uma aplicação java desktop que utiliza Swing. Já me indicaram o JFreeChart, mas pelo que vi, ele não possui gráficos dinâmicos de barras.

Quando falo de gráficos dinâmicos, significa que eu preciso alterar os dados do gráfico, sem ser preciso criar uma nova instancia do mesmo para exibir a alteração dos dados.

Desde já agradeço a todos.

Um gde abço!!!

Mas o pq de não criar uma nova instância e substituir o gráfico existente pelo novo??

O que pode dar para fazer é tu pegar um novo dataset, com os novos dados, setar no objeto JFreeChart já existente e mandar ele atualizar os dados…

Fernando Rosa

Opaa

Eu desenvolvo aplicações web, para gerar graficos dinâmicos online eu uso o FusionCharts (http://www.fusioncharts.com/). Tem um monte de tipos de gráficos. Não é free mas quebra um galho.

Só montar um XML e tocar nele e boa.

Agora, desktop não faço idéia.

:slight_smile:

Abraço

Bom,

A aplicação que tenho é para o meu projeto de mestrado. Dependendo dos eventos que ocorrem em uma arquitetura, os dados são atualizados.

O gráfico ficará em um JPanel na interface JFrame principal, que exibe o funcionamento da arquitetura.

Seria interessante mostrar a alteração dos dados (no gráfico) de forma bem dinâmica. Eu posso até criar uma nova instância, desde que eu não tenha que encerrar a aplicação ou o próprio gráfico.

Vou tentar criar um novo dataSet e ver um comando pra atualizar os dados no JFreeChart já criado.

Valeu pela força.

[quote=vinipta]Olá pessoal,

preciso trabalhar com gráficos de barras dinâmicos em uma aplicação

java desktop que utiliza Swing. Já me indicaram o JFreeChart, mas pelo

que vi, ele não possui gráficos dinâmicos de barras.

Quando falo de gráficos dinâmicos, significa que eu preciso alterar os

dados do gráfico, sem ser preciso criar uma nova instancia do mesmo

para exibir a alteração dos dados.

Desde já agradeço a todos.

Um gde abço!!![/quote]

RESOLVENDO MAIS UM EXERCÍCIO DE FACULDADE

não deveria, mas vou dar um exemplo de grafico dinâmico q eu comecei a

desenvolver (JÁ TÁ ANIMADO - VC CONFIGURA SE KER Q SEJA ANIMADO) …

TENTA ENTENDER POIS THA FACIL, E DEPOIS VC PODE USAR O JFREECHART

MESMO … É DE GRAÇA … UMA DICA É SEMPRE LEMBRAR DE NÃO FICAR

“AMMARADO” A NENHUM OUTRO FRAMEWORK, PELO MENOS NÃO NO APRENDIZADO, E

DEPOIS SIM PARTIR PARA UM JÁ DESENVOLVIDO E AMADURECIDO … USAR ALGUM

PAGO, NÃO É ACONSELHÁVEL ! MAS DECIDA POR VC MESMO.

tente entender, e se necessário for, envie uma pergunte.
E como o código q eu ainda estava realizado tá sem teste JUnit, q tal

fazê-los ?

Fique a vontade para realizar refactor do código utilizando sua

própria nomenclatura/estrutura.

KubicSwingTagChartBarPanel - Ele extends JPanel - então ele é um

JPanel - to bonzinho e coloquei um main pra facilitar. Eu estou o

utilizando como um componente Panel dentro de um framework q estou a

terminar.

package br.com.kubic.kubicFramework.swing.tags.panel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Paint;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Rectangle2D;
import java.util.Timer;
import java.util.TimerTask;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;

import br.com.kubic.kubicFramework.internalCore.bean.KubicChartBean;
import 

br.com.kubic.kubicFramework.internalCore.services.bigDecimal.KubicBigD

ecimal;

public class KubicSwingTagChartBarPanel extends JPanel implements
		ActionListener {

	boolean animatedChart = false;
	private static int DELAY = 10;
	private Insets insets;
	private int counter = 0;
	private double[] theValor = null;
	private int values[] = { 100, 10, 50, 50, 50, 50 };
	private int[] barra;
	private int[] starter;
	private Color[] corDaBarra;
	private Color[] coresPossiveis = { Color.RED, Color.CYAN, 

Color.blue,
			Color.green, Color.yellow, Color.orange, 

Color.pink };
	private int steps = values.length;
	private int stepSize = 360 / steps;
	public double tamanho = 0;
	private double valueToView = 0;
	private double valueToView2 = 0;
	private int alturaBarraMax = 0;
	private double maximo = 0;
	private String theTitle;
	private RenderingHints hints = null;
	private String[] labels = null;
	private int larguraBarra = 100;
	private Graphics2D g2 = null;
	public KubicChartBean chartBean2 = null;
	private TimerTask task = null;

	public void repaint() {
		if (chartBean2 != null && g2 != null) {
			this.theValor = chartBean2.getValor();
			this.labels = chartBean2.getLabels();
			this.theTitle = chartBean2.getTitulo();
			this.animatedChart = chartBean2.isAnimate();

			// cria numero de barras igual a quantidade
			// de numeros passados
			int tamanho = theValor.length;
			barra = new int[tamanho];
			corDaBarra = new Color[tamanho];
			// descobre o maior valor
			double maximo = 0;
			for (int count = 0; count < tamanho; count++) 

{
				if (theValor[count] > maximo) {
					maximo = theValor[count];
				}
			}
			// guarda a informacao em valores relativos ao
			// maximo, onde este vale 100 e outros valem
			// uma porcentagem deste maximo sem casas 

decimais
			for (int count = 0; count < tamanho; count++) 

{
				barra[count] = (int) (100 * 

(theValor[count] / maximo));
				corDaBarra[count] = 

coresPossiveis[count
						% 

coresPossiveis.length];
			}

			if (animatedChart) {

				starter = new int[values.length];

				int larguraJanela = getWidth();
				int alturaJanela = getHeight();
				int baseBarras = alturaJanela - 50;
				int quantidadeDeBarras = barra.length;
				int tamanhoItem = (larguraJanela / 

quantidadeDeBarras);
				int espacoEsquerda = 20;
				// int larguraBarra = (int) (0.8 * 

tamanhoItem);
				alturaBarraMax = alturaJanela - 70 - 

50;

				String titulo = this.theTitle;

				for (int count = 0; count < 

quantidadeDeBarras; count++) {
					int altura = (int) 

((barra[count] * alturaBarraMax) / 100);
					int x2 = count * tamanhoItem + 

espacoEsquerda;
					// int y2 = baseBarras - 

altura;
					int y2 = baseBarras;
					// System.out.println("altura" 

+ altura );
					if (tamanho <= alturaBarraMax) 

{
						valueToView = 

((tamanho / alturaBarraMax) * theValor[count]) * 1.1;
						valueToView2 = 

((tamanho / alturaBarraMax) * barra[count]) * 1.1;
					}

					Rectangle2D r = new 

Rectangle2D.Double(0, 0, larguraBarra,
							20);

					if (tamanho < altura) {
						/*
						 * 

g2.setColor(corDaBarra[count]); r = new
						 * 

Rectangle2D.Double(x2, y2 - tamanho, larguraBarra,
						 * tamanho);
						 */

						int 

indiceFaddingInicial = 255;
						int theIndiceFadding = 

(int) (indiceFaddingInicial * (tamanho / alturaBarraMax));

						Color 

theColorBarraFadding = new Color(
								

corDaBarra[count].getRed(), corDaBarra[count]
									

	.getGreen(), corDaBarra[count]
									

	.getBlue(), theIndiceFadding);
						

g2.setColor(theColorBarraFadding);
						r = new 

Rectangle2D.Double(x2, y2 - tamanho,
								

larguraBarra, tamanho);

					}

					else {
						valueToView2 = 

barra[count];
						

g2.setColor(corDaBarra[count]);
						r = new 

Rectangle2D.Double(x2, baseBarras - altura,
								

larguraBarra, altura);
					}

					g2.fill(r);

					// 

g2.drawString(KubicBigDecimal.getParteInteira(theValor[count],
					// 2) + "." +
					// 

KubicBigDecimal.getParteCentavos(theValor[count], 2) + "
					// =" + " " + 

KubicBigDecimal.getParteInteira(barra[count],
					// 2) + "." + 

KubicBigDecimal.getParteCentavos(barra[count],
					// 2) + "% " , x2, 

baseBarras+15);
					g2.setColor(Color.white);
					if (tamanho < altura && 

valueToView < theValor[count]) {
						

g2.drawString(KubicBigDecimal.getParteInteira(
								

valueToView, 2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(valueToView,
									

	2)
								+ " ="
								+ " "
								+ 

KubicBigDecimal.getParteInteira(valueToView2,
									

	2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(
									

	valueToView2, 2) + "% ", x2,
								

baseBarras + 15);
					}

					else {
						altura = (int) 

((barra[count] * alturaBarraMax) / 100);
						

g2.drawString(KubicBigDecimal.getParteInteira(
								

theValor[count], 2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(
									

	theValor[count], 2)
								+ " ="
								+ " "
								+ 

KubicBigDecimal.getParteInteira(barra[count],
									

	2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(
									

	barra[count], 2) + "% ", x2,
								

baseBarras + 15);
					}
					// 

g2.drawString(KubicBigDecimal.getParteInteira(theValor[count],
					// 2) + "." +
					// 

KubicBigDecimal.getParteCentavos(theValor[count], 2) + "
					// =" + " " + 

KubicBigDecimal.getParteInteira(barra[count],
					// 2) + "." + 

KubicBigDecimal.getParteCentavos(barra[count],
					// 2) + "% " , x2, 

baseBarras+15);

				}
			}
		}
		super.repaint();
	}

	public KubicSwingTagChartBarPanel(KubicChartBean chartBean) {

		chartBean2 = chartBean;
		this.theValor = chartBean.getValor();
		this.labels = chartBean.getLabels();
		this.theTitle = chartBean.getTitulo();
		this.animatedChart = chartBean.isAnimate();
		// DEFINICOES DE RENDEREIZACAO
		hints = new 

RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
				

RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
		hints.put(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		hints.put(RenderingHints.KEY_COLOR_RENDERING,
				

RenderingHints.VALUE_COLOR_RENDER_QUALITY);
		hints.put(RenderingHints.KEY_INTERPOLATION,
				

RenderingHints.VALUE_INTERPOLATION_BILINEAR);
		hints.put(RenderingHints.KEY_RENDERING,
				RenderingHints.VALUE_RENDER_QUALITY);
		// cria numero de barras igual a quantidade
		// de numeros passados
		int tamanho = theValor.length;
		barra = new int[tamanho];
		corDaBarra = new Color[tamanho];
		// descobre o maior valor
		double maximo = 0;
		for (int count = 0; count < tamanho; count++) {
			if (theValor[count] > maximo) {
				maximo = theValor[count];
			}
		}
		// guarda a informacao em valores relativos ao
		// maximo, onde este vale 100 e outros valem
		// uma porcentagem deste maximo sem casas decimais
		for (int count = 0; count < tamanho; count++) {
			barra[count] = (int) (100 * (theValor[count] / 

maximo));
			corDaBarra[count] = coresPossiveis[count % 

coresPossiveis.length];
		}

	}

	public void paintComponent(Graphics graphics) {

		if (hints != null) {
			counter++;
			g2 = (Graphics2D) graphics;
			g2.setRenderingHints(hints);
			super.paintComponent(g2);

			// GRADIENTE PANEL
			final int heightGradiente = getHeight();

			Color gradientStart = new Color(0, 0, 0);// 

220, 255, 149);
			Color gradientEnd = new Color(0, 0, 0);// 183, 

234, 98);

			GradientPaint painter = new GradientPaint(0, 

0, gradientStart, 0,
					heightGradiente, gradientEnd);
			final Paint oldPainter = g2.getPaint();
			g2.setPaint(painter);
			g2.fill(g2.getClip());

			gradientStart = new Color(0, 0, 0, 200);
			gradientEnd = new Color(0, 0, 0, 255);

			painter = new GradientPaint(0, 0, gradientEnd, 

0,
					heightGradiente / 2, 

gradientStart);
			g2.setPaint(painter);
			g2.fill(g2.getClip());

			painter = new GradientPaint(0, heightGradiente 

/ 2, gradientStart,
					0, heightGradiente, 

gradientEnd);
			g2.setPaint(painter);
			g2.fill(g2.getClip());

			g2.setPaint(oldPainter);

			this.setBackground(Color.black);
			Rectangle2D r = new Rectangle2D.Double(0, 0, 

larguraBarra, 20);
			if (insets == null) {
				insets = getInsets();
			}

			starter = new int[values.length];

			int larguraJanela = getWidth();
			int alturaJanela = getHeight();
			int baseBarras = alturaJanela - 50;
			int quantidadeDeBarras = barra.length;
			int tamanhoItem = (larguraJanela / 

quantidadeDeBarras);
			int espacoEsquerda = 20;
			// int larguraBarra = (int) (0.8 * 

tamanhoItem);
			alturaBarraMax = alturaJanela - 70 - 50;

			String titulo = this.theTitle;

			g2.setColor(Color.white);
			Font fonte = new Font("Tahoma", Font.BOLD, 

20);
			g2.setFont(fonte);
			g2.drawString(titulo, espacoEsquerda - 1, 

baseBarras
					- alturaBarraMax - 35);

			for (int count = 0; count < 

quantidadeDeBarras; count++) {
				int altura = (int) ((barra[count] * 

alturaBarraMax) / 100);
				int x2 = count * tamanhoItem + 

espacoEsquerda;
				int y2 = baseBarras - altura;
				r = new Rectangle2D.Double(x2 - 2, y2 

- 2, larguraBarra + 3,
						altura + 3);

				g2.setColor(Color.white);
				g2.draw(r);
				// g2d.drawString("" + (count+1) + "-" 

+ labels[count], x+1,
				// baseBarras-altura-10);
				String theLabelForGraphic = 

labels[count].toUpperCase();

				int numeroMaximoCaracteresLabel = 15;
				if (theLabelForGraphic.length() > 

numeroMaximoCaracteresLabel) {
					theLabelForGraphic = 

theLabelForGraphic.substring(0,
							

numeroMaximoCaracteresLabel);
				}

				fonte = new Font("Tahoma", 

Font.ITALIC, 11);
				g2.setFont(fonte);
				g2.drawString("" + theLabelForGraphic, 

x2 + 1, baseBarras
						- altura - 10);

			}

			if (animatedChart) {
				for (int count = 0; count < 

quantidadeDeBarras; count++) {
					int altura = (int) 

((barra[count] * alturaBarraMax) / 100);
					int x2 = count * tamanhoItem + 

espacoEsquerda;
					// int y2 = baseBarras - 

altura;
					int y2 = baseBarras;
					// System.out.println("altura" 

+ altura );
					if (tamanho <= alturaBarraMax) 

{
						valueToView = 

((tamanho / alturaBarraMax) * theValor[count]) * 1.1;
						valueToView2 = 

((tamanho / alturaBarraMax) * barra[count]) * 1.1;
					}

					if (tamanho < altura) {
						/*
						 * 

g2.setColor(corDaBarra[count]); r = new
						 * 

Rectangle2D.Double(x2, y2 - tamanho, larguraBarra,
						 * tamanho);
						 */

						int 

indiceFaddingInicial = 255;
						int theIndiceFadding = 

(int) (indiceFaddingInicial * (tamanho / alturaBarraMax));

						Color 

theColorBarraFadding = new Color(
								

corDaBarra[count].getRed(), corDaBarra[count]
									

	.getGreen(), corDaBarra[count]
									

	.getBlue(), theIndiceFadding);
						

g2.setColor(theColorBarraFadding);
						r = new 

Rectangle2D.Double(x2, y2 - tamanho,
								

larguraBarra, tamanho);

					}

					else {
						valueToView2 = 

barra[count];
						

g2.setColor(corDaBarra[count]);
						r = new 

Rectangle2D.Double(x2, baseBarras - altura,
								

larguraBarra, altura);
					}

					g2.fill(r);

					// 

g2.drawString(KubicBigDecimal.getParteInteira(theValor[count],
					// 2) + "." +
					// 

KubicBigDecimal.getParteCentavos(theValor[count], 2) + "
					// =" + " " + 

KubicBigDecimal.getParteInteira(barra[count],
					// 2) + "." + 

KubicBigDecimal.getParteCentavos(barra[count],
					// 2) + "% " , x2, 

baseBarras+15);
					g2.setColor(Color.white);
					if (tamanho < altura && 

valueToView < theValor[count]) {
						

g2.drawString(KubicBigDecimal.getParteInteira(
								

valueToView, 2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(valueToView,
									

	2)
								+ " ="
								+ " "
								+ 

KubicBigDecimal.getParteInteira(valueToView2,
									

	2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(
									

	valueToView2, 2) + "% ", x2,
								

baseBarras + 15);
					}

					else {
						altura = (int) 

((barra[count] * alturaBarraMax) / 100);
						

g2.drawString(KubicBigDecimal.getParteInteira(
								

theValor[count], 2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(
									

	theValor[count], 2)
								+ " ="
								+ " "
								+ 

KubicBigDecimal.getParteInteira(barra[count],
									

	2)
								+ "."
								+ 

KubicBigDecimal.getParteCentavos(
									

	barra[count], 2) + "% ", x2,
								

baseBarras + 15);
					}
					// 

g2.drawString(KubicBigDecimal.getParteInteira(theValor[count],
					// 2) + "." +
					// 

KubicBigDecimal.getParteCentavos(theValor[count], 2) + "
					// =" + " " + 

KubicBigDecimal.getParteInteira(barra[count],
					// 2) + "." + 

KubicBigDecimal.getParteCentavos(barra[count],
					// 2) + "% " , x2, 

baseBarras+15);

				}
			}

			else {
				for (int count = 0; count < 

quantidadeDeBarras; count++) {
					int altura = (int) 

((barra[count] * alturaBarraMax) / 100);
					int x2 = count * tamanhoItem + 

espacoEsquerda;
					// int y2 = baseBarras - 

altura;
					int y2 = baseBarras;
					r = new Rectangle2D.Double(x2, 

baseBarras - altura,
							larguraBarra, 

altura);

					

g2.setColor(corDaBarra[count]);
					g2.fill(r);
					altura = (int) ((barra[count] 

* alturaBarraMax) / 100);

					g2.setColor(Color.white);
					

g2.drawString(KubicBigDecimal.getParteInteira(
							

theValor[count], 2)
							+ "."
							+ 

KubicBigDecimal.getParteCentavos(theValor[count],
									

2)
							+ " ="
							+ " "
							+ 

KubicBigDecimal.getParteInteira(barra[count], 2)
							+ "."
							+ 

KubicBigDecimal.getParteCentavos(barra[count], 2)
							+ "% ", x2, 

baseBarras + 15);
				}
			}

			g2.dispose();
		}

		else {
			final Graphics2D g2 = (Graphics2D) graphics;
			g2.dispose();
		}

	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String[] args) {
		Runnable doCreateAndShowGUI = new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		};
		SwingUtilities.invokeLater(doCreateAndShowGUI);
	}

	private static void createAndShowGUI() {
		final String tituloChart = "KUBIC CHART";
		JFrame f = new JFrame(tituloChart);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setSize(800, 300);

		/*
		 * KubicChartBean chartBean = new KubicChartBean();
		 * chartBean.setLabels(labels); 

chartBean.setValor(valor);
		 * chartBean.setTitulo(tituloChart);
		 */

		// public AnimateBar(double [] valor, String [] 

labels, String title){
		String tituloChart2 = "KUBIC CHART";
		double[] valuesToChart = { 201.05, 33.22, 44.22, 

100.22, 100.22,
				100.00, 22.01 };
		String[] labelToChart = { "SHELSON", "SHELSON",
				"TESTE", "TESTE2", "TESTE3", "sss", 

"sss" };
		boolean animateChart = true;

		KubicChartBean chartBean = new KubicChartBean();
		chartBean.setLabels(labelToChart);
		chartBean.setValor(valuesToChart);
		chartBean.setTitulo(tituloChart);
		chartBean.setAnimate(animateChart);

		KubicSwingTagChartBarPanel animate = new 

KubicSwingTagChartBarPanel(
				chartBean);
		int animateWidth = (labelToChart.length * 120) + 50;
		int animateHeight = 300;
		animate
				.setPreferredSize(new 

Dimension(animateWidth,
						animateHeight - 50));
		f.setVisible(true);
		JScrollPane scroll = new JScrollPane(animate);
		scroll.setPreferredSize(new Dimension(400, 

animateHeight));
		f.add(scroll);
		animate.go();

	}

	public void repaint2() {
		super.repaint();
	}

	public void go() {
		if (task == null) {
			task = new TimerTask() {
				public void run() {
					if (tamanho <= alturaBarraMax) 

{
						// 

System.out.println("alturaBarraMax-" +
						// alturaBarraMax);
						// 

System.out.println("tamanho-" + tamanho);
						tamanho += 1.0;
						repaint2();
					} else {

					}
				}
			};
			Timer timer = new Timer();
			timer.schedule(task, 0, DELAY);
		}

	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub

	}

}

KubicChartBean - Bean q encapsula as definições de estilo da chart.
É necessário criar outro Bean para encapsular os dados a serem

exibidos. busque no código os mesmos, e utilize-os em sua app.


package br.com.kubic.kubicFramework.internalCore.bean;

/**
 * 
 * @author SHELSON
 *
 */
public class KubicChartBean {

	/**
	 * 
	 */
	private boolean animate;

	/**
	 * 
	 */
	private String titulo;

	/**
	 * 
	 */
	private double[] valor;
	
	/**
	 * 
	 */
	private String[] labels;

	/**
	 * 
	 */
	private int width;

	/**
	 * 
	 */
	private int height;

	/**
	 * 
	 */
	private String background_labelsR;

	/**
	 * 
	 */
	private String background_labelsG;

	/**
	 * 
	 */
	private String background_labelsB;

	/**
	 * 
	 */
	private String background_percentualR;

	/**
	 * 
	 */
	private String background_percentualG;

	/**
	 * 
	 */
	private String background_percentualB;

	/**
	 * 
	 */
	private String foreground_labelsR;

	/**
	 * 
	 */
	private String foreground_labelsG;

	/**
	 * 
	 */
	private String foreground_labelsB;

	/**
	 * 
	 */
	private String foreground_percentualR;

	/**
	 * 
	 */
	private String foreground_percentualG;

	/**
	 * 
	 */
	private String foreground_percentualB;

	/**
	 * 
	 */
	private String fonte_titulo_labels;

	/**
	 * 
	 */
	private int tamanho_fonte_titulo_labels;

	/**
	 * 
	 */
	private String fonte_titulo_percentual;

	/**
	 * 
	 */
	private int tamanho_fonte_titulo_percentual;

	/**
	 * 
	 */
	private String background_tituloR;

	/**
	 * 
	 */
	private String background_tituloG;

	/**
	 * 
	 */
	private String background_tituloB;

	/**
	 * 
	 */
	private String foreground_tituloR;

	/**
	 * 
	 */
	private String foreground_tituloG;

	/**
	 * 
	 */
	private String foreground_tituloB;

	/**
	 * 
	 */
	private String titulo_opaque;
	
	/**
	 * 
	 */
	private String fonte_titulo;

	/**
	 * 
	 */
	private int tamanho_fonte_titulo;

	/**
	 * 
	 */
	private int backgroundFonteR;

	/**
	 * 
	 */
	private int backgroundFonteG;

	/**
	 * 
	 */
	private int backgroundFonteB;

	/**
	 * 
	 */
	private int foregroundFonteR;

	/**
	 * 
	 */
	private int foregroundFonteG;

	/**
	 * 
	 */
	private int foregroundFonteB;

	/**
	 * 
	 */
	private int backgroundGraficoR;

	/**
	 * 
	 */
	private int backgroundGraficoG;

	/**
	 * 
	 */
	private int backgroundGraficoB;

	/**
	 * 
	 */
	private boolean showLinesGuides;

	/**
	 * 
	 */
	private boolean showLabel;
	
	/**
	 * 
	 */
	private boolean showTitle;
	
	/**
	 * 
	 */
	private boolean showValues;
	
	/**
	 * 
	 */
	private boolean showPencetualValues;
	
	/**
	 * 
	 */
	private boolean showLegenda;
	
	/**
	 * 
	 */
	private boolean fadding;
	

	/**
	 * @return the valor
	 */
	public double[] getValor() {
		return valor;
	}

	/**
	 * @param valor the valor to set
	 */
	public void setValor(double[] valor) {
		this.valor = valor;
	}

	/**
	 * @return the labels
	 */
	public String[] getLabels() {
		return labels;
	}

	/**
	 * @param labels the labels to set
	 */
	public void setLabels(String[] labels) {
		this.labels = labels;
	}

	/**
	 * @return the titulo
	 */
	public String getTitulo() {
		return titulo;
	}

	/**
	 * @param titulo the titulo to set
	 */
	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}

	/**
	 * @return the width
	 */
	public int getWidth() {
		return width;
	}

	/**
	 * @param width the width to set
	 */
	public void setWidth(int width) {
		this.width = width;
	}

	/**
	 * @return the height
	 */
	public int getHeight() {
		return height;
	}

	/**
	 * @param height the height to set
	 */
	public void setHeight(int height) {
		this.height = height;
	}

	/**
	 * @return the animate
	 */
	public boolean isAnimate() {
		return animate;
	}

	/**
	 * @param animate the animate to set
	 */
	public void setAnimate(boolean animate) {
		this.animate = animate;
	}

	/**
	 * @return the background_labelsR
	 */
	public String getBackground_labelsR() {
		return background_labelsR;
	}

	/**
	 * @param background_labelsR the background_labelsR to set
	 */
	public void setBackground_labelsR(String background_labelsR) {
		this.background_labelsR = background_labelsR;
	}

	/**
	 * @return the background_labelsG
	 */
	public String getBackground_labelsG() {
		return background_labelsG;
	}

	/**
	 * @param background_labelsG the background_labelsG to set
	 */
	public void setBackground_labelsG(String background_labelsG) {
		this.background_labelsG = background_labelsG;
	}

	/**
	 * @return the background_labelsB
	 */
	public String getBackground_labelsB() {
		return background_labelsB;
	}

	/**
	 * @param background_labelsB the background_labelsB to set
	 */
	public void setBackground_labelsB(String background_labelsB) {
		this.background_labelsB = background_labelsB;
	}

	/**
	 * @return the background_percentualR
	 */
	public String getBackground_percentualR() {
		return background_percentualR;
	}

	/**
	 * @param background_percentualR the background_percentualR to 

set
	 */
	public void setBackground_percentualR(String 

background_percentualR) {
		this.background_percentualR = background_percentualR;
	}

	/**
	 * @return the background_percentualG
	 */
	public String getBackground_percentualG() {
		return background_percentualG;
	}

	/**
	 * @param background_percentualG the background_percentualG to 

set
	 */
	public void setBackground_percentualG(String 

background_percentualG) {
		this.background_percentualG = background_percentualG;
	}

	/**
	 * @return the background_percentualB
	 */
	public String getBackground_percentualB() {
		return background_percentualB;
	}

	/**
	 * @param background_percentualB the background_percentualB to 

set
	 */
	public void setBackground_percentualB(String 

background_percentualB) {
		this.background_percentualB = background_percentualB;
	}

	/**
	 * @return the foreground_labelsR
	 */
	public String getForeground_labelsR() {
		return foreground_labelsR;
	}

	/**
	 * @param foreground_labelsR the foreground_labelsR to set
	 */
	public void setForeground_labelsR(String foreground_labelsR) {
		this.foreground_labelsR = foreground_labelsR;
	}

	/**
	 * @return the foreground_labelsG
	 */
	public String getForeground_labelsG() {
		return foreground_labelsG;
	}

	/**
	 * @param foreground_labelsG the foreground_labelsG to set
	 */
	public void setForeground_labelsG(String foreground_labelsG) {
		this.foreground_labelsG = foreground_labelsG;
	}

	/**
	 * @return the foreground_labelsB
	 */
	public String getForeground_labelsB() {
		return foreground_labelsB;
	}

	/**
	 * @param foreground_labelsB the foreground_labelsB to set
	 */
	public void setForeground_labelsB(String foreground_labelsB) {
		this.foreground_labelsB = foreground_labelsB;
	}

	/**
	 * @return the foreground_percentualR
	 */
	public String getForeground_percentualR() {
		return foreground_percentualR;
	}

	/**
	 * @param foreground_percentualR the foreground_percentualR to 

set
	 */
	public void setForeground_percentualR(String 

foreground_percentualR) {
		this.foreground_percentualR = foreground_percentualR;
	}

	/**
	 * @return the foreground_percentualG
	 */
	public String getForeground_percentualG() {
		return foreground_percentualG;
	}

	/**
	 * @param foreground_percentualG the foreground_percentualG to 

set
	 */
	public void setForeground_percentualG(String 

foreground_percentualG) {
		this.foreground_percentualG = foreground_percentualG;
	}

	/**
	 * @return the foreground_percentualB
	 */
	public String getForeground_percentualB() {
		return foreground_percentualB;
	}

	/**
	 * @param foreground_percentualB the foreground_percentualB to 

set
	 */
	public void setForeground_percentualB(String 

foreground_percentualB) {
		this.foreground_percentualB = foreground_percentualB;
	}

	/**
	 * @return the fonte_titulo_labels
	 */
	public String getFonte_titulo_labels() {
		return fonte_titulo_labels;
	}

	/**
	 * @param fonte_titulo_labels the fonte_titulo_labels to set
	 */
	public void setFonte_titulo_labels(String fonte_titulo_labels) 

{
		this.fonte_titulo_labels = fonte_titulo_labels;
	}

	/**
	 * @return the tamanho_fonte_titulo_labels
	 */
	public int getTamanho_fonte_titulo_labels() {
		return tamanho_fonte_titulo_labels;
	}

	/**
	 * @param tamanho_fonte_titulo_labels the 

tamanho_fonte_titulo_labels to set
	 */
	public void setTamanho_fonte_titulo_labels(int 

tamanho_fonte_titulo_labels) {
		this.tamanho_fonte_titulo_labels = 

tamanho_fonte_titulo_labels;
	}

	/**
	 * @return the fonte_titulo_percentual
	 */
	public String getFonte_titulo_percentual() {
		return fonte_titulo_percentual;
	}

	/**
	 * @param fonte_titulo_percentual the fonte_titulo_percentual 

to set
	 */
	public void setFonte_titulo_percentual(String 

fonte_titulo_percentual) {
		this.fonte_titulo_percentual = 

fonte_titulo_percentual;
	}

	/**
	 * @return the tamanho_fonte_titulo_percentual
	 */
	public int getTamanho_fonte_titulo_percentual() {
		return tamanho_fonte_titulo_percentual;
	}

	/**
	 * @param tamanho_fonte_titulo_percentual the 

tamanho_fonte_titulo_percentual to set
	 */
	public void setTamanho_fonte_titulo_percentual(
			int tamanho_fonte_titulo_percentual) {
		this.tamanho_fonte_titulo_percentual = 

tamanho_fonte_titulo_percentual;
	}

	/**
	 * @return the background_tituloR
	 */
	public String getBackground_tituloR() {
		return background_tituloR;
	}

	/**
	 * @param background_tituloR the background_tituloR to set
	 */
	public void setBackground_tituloR(String background_tituloR) {
		this.background_tituloR = background_tituloR;
	}

	/**
	 * @return the background_tituloG
	 */
	public String getBackground_tituloG() {
		return background_tituloG;
	}

	/**
	 * @param background_tituloG the background_tituloG to set
	 */
	public void setBackground_tituloG(String background_tituloG) {
		this.background_tituloG = background_tituloG;
	}

	/**
	 * @return the background_tituloB
	 */
	public String getBackground_tituloB() {
		return background_tituloB;
	}

	/**
	 * @param background_tituloB the background_tituloB to set
	 */
	public void setBackground_tituloB(String background_tituloB) {
		this.background_tituloB = background_tituloB;
	}

	/**
	 * @return the foreground_tituloR
	 */
	public String getForeground_tituloR() {
		return foreground_tituloR;
	}

	/**
	 * @param foreground_tituloR the foreground_tituloR to set
	 */
	public void setForeground_tituloR(String foreground_tituloR) {
		this.foreground_tituloR = foreground_tituloR;
	}

	/**
	 * @return the foreground_tituloG
	 */
	public String getForeground_tituloG() {
		return foreground_tituloG;
	}

	/**
	 * @param foreground_tituloG the foreground_tituloG to set
	 */
	public void setForeground_tituloG(String foreground_tituloG) {
		this.foreground_tituloG = foreground_tituloG;
	}

	/**
	 * @return the foreground_tituloB
	 */
	public String getForeground_tituloB() {
		return foreground_tituloB;
	}

	/**
	 * @param foreground_tituloB the foreground_tituloB to set
	 */
	public void setForeground_tituloB(String foreground_tituloB) {
		this.foreground_tituloB = foreground_tituloB;
	}

	/**
	 * @return the titulo_opaque
	 */
	public String getTitulo_opaque() {
		return titulo_opaque;
	}

	/**
	 * @param titulo_opaque the titulo_opaque to set
	 */
	public void setTitulo_opaque(String titulo_opaque) {
		this.titulo_opaque = titulo_opaque;
	}

	/**
	 * @return the fonte_titulo
	 */
	public String getFonte_titulo() {
		return fonte_titulo;
	}

	/**
	 * @param fonte_titulo the fonte_titulo to set
	 */
	public void setFonte_titulo(String fonte_titulo) {
		this.fonte_titulo = fonte_titulo;
	}

	/**
	 * @return the tamanho_fonte_titulo
	 */
	public int getTamanho_fonte_titulo() {
		return tamanho_fonte_titulo;
	}

	/**
	 * @param tamanho_fonte_titulo the tamanho_fonte_titulo to set
	 */
	public void setTamanho_fonte_titulo(int tamanho_fonte_titulo) 

{
		this.tamanho_fonte_titulo = tamanho_fonte_titulo;
	}

	/**
	 * @return the backgroundFonteR
	 */
	public int getBackgroundFonteR() {
		return backgroundFonteR;
	}

	/**
	 * @param backgroundFonteR the backgroundFonteR to set
	 */
	public void setBackgroundFonteR(int backgroundFonteR) {
		this.backgroundFonteR = backgroundFonteR;
	}

	/**
	 * @return the backgroundFonteG
	 */
	public int getBackgroundFonteG() {
		return backgroundFonteG;
	}

	/**
	 * @param backgroundFonteG the backgroundFonteG to set
	 */
	public void setBackgroundFonteG(int backgroundFonteG) {
		this.backgroundFonteG = backgroundFonteG;
	}

	/**
	 * @return the backgroundFonteB
	 */
	public int getBackgroundFonteB() {
		return backgroundFonteB;
	}

	/**
	 * @param backgroundFonteB the backgroundFonteB to set
	 */
	public void setBackgroundFonteB(int backgroundFonteB) {
		this.backgroundFonteB = backgroundFonteB;
	}

	/**
	 * @return the foregroundFonteR
	 */
	public int getForegroundFonteR() {
		return foregroundFonteR;
	}

	/**
	 * @param foregroundFonteR the foregroundFonteR to set
	 */
	public void setForegroundFonteR(int foregroundFonteR) {
		this.foregroundFonteR = foregroundFonteR;
	}

	/**
	 * @return the foregroundFonteG
	 */
	public int getForegroundFonteG() {
		return foregroundFonteG;
	}

	/**
	 * @param foregroundFonteG the foregroundFonteG to set
	 */
	public void setForegroundFonteG(int foregroundFonteG) {
		this.foregroundFonteG = foregroundFonteG;
	}

	/**
	 * @return the foregroundFonteB
	 */
	public int getForegroundFonteB() {
		return foregroundFonteB;
	}

	/**
	 * @param foregroundFonteB the foregroundFonteB to set
	 */
	public void setForegroundFonteB(int foregroundFonteB) {
		this.foregroundFonteB = foregroundFonteB;
	}

	/**
	 * @return the backgroundGraficoR
	 */
	public int getBackgroundGraficoR() {
		return backgroundGraficoR;
	}

	/**
	 * @param backgroundGraficoR the backgroundGraficoR to set
	 */
	public void setBackgroundGraficoR(int backgroundGraficoR) {
		this.backgroundGraficoR = backgroundGraficoR;
	}

	/**
	 * @return the backgroundGraficoG
	 */
	public int getBackgroundGraficoG() {
		return backgroundGraficoG;
	}

	/**
	 * @param backgroundGraficoG the backgroundGraficoG to set
	 */
	public void setBackgroundGraficoG(int backgroundGraficoG) {
		this.backgroundGraficoG = backgroundGraficoG;
	}

	/**
	 * @return the backgroundGraficoB
	 */
	public int getBackgroundGraficoB() {
		return backgroundGraficoB;
	}

	/**
	 * @param backgroundGraficoB the backgroundGraficoB to set
	 */
	public void setBackgroundGraficoB(int backgroundGraficoB) {
		this.backgroundGraficoB = backgroundGraficoB;
	}

	/**
	 * @return the showLinesGuides
	 */
	public boolean isShowLinesGuides() {
		return showLinesGuides;
	}

	/**
	 * @param showLinesGuides the showLinesGuides to set
	 */
	public void setShowLinesGuides(boolean showLinesGuides) {
		this.showLinesGuides = showLinesGuides;
	}

	/**
	 * @return the showLabel
	 */
	public boolean isShowLabel() {
		return showLabel;
	}

	/**
	 * @param showLabel the showLabel to set
	 */
	public void setShowLabel(boolean showLabel) {
		this.showLabel = showLabel;
	}

	/**
	 * @return the showTitle
	 */
	public boolean isShowTitle() {
		return showTitle;
	}

	/**
	 * @param showTitle the showTitle to set
	 */
	public void setShowTitle(boolean showTitle) {
		this.showTitle = showTitle;
	}

	/**
	 * @return the showValues
	 */
	public boolean isShowValues() {
		return showValues;
	}

	/**
	 * @param showValues the showValues to set
	 */
	public void setShowValues(boolean showValues) {
		this.showValues = showValues;
	}

	/**
	 * @return the showPencetualValues
	 */
	public boolean isShowPencetualValues() {
		return showPencetualValues;
	}

	/**
	 * @param showPencetualValues the showPencetualValues to set
	 */
	public void setShowPencetualValues(boolean 

showPencetualValues) {
		this.showPencetualValues = showPencetualValues;
	}

	/**
	 * @return the fadding
	 */
	public boolean isFadding() {
		return fadding;
	}

	/**
	 * @param fadding the fadding to set
	 */
	public void setFadding(boolean fadding) {
		this.fadding = fadding;
	}

}

KubicBigDecimal - classezinha "meia-boca" q toh utilizando para

manipulação de valores. Deve ter muita coisa melhor na net. Mas já

serve … Se alguma boa alma poder inclusive me ajudar nesta vertente,

desde já agradeço.

package br.com.kubic.kubicFramework.internalCore.services.bigDecimal;
import java.math.BigDecimal;
import java.math.BigInteger;

import 

br.com.kubic.kubicFramework.internalCore.services.validate.KubicValida

te;

/**
 * CLASSE ASSISTENTE PARA SISTEMAS FINANCEIROS
 * COM BUGS ARRUMADOS EM ABRIL DE 2008.
 * @author SHELSON FERRARI
 *
 */
public abstract class KubicBigDecimal {

	/**
	 * compara dois objetos
	 * @param v1 primeiro objeto
	 * @param v2 segundo objeto
	 * @return true se iguais
	 */
	public static boolean compara(Object v1, Object v2){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		// NULL
		if(v2==null){
			v2 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v2 instanceof Integer){
			if( v2==null || ((Integer)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Integer)v2));
		}
		// DOUBLE
		else if(v2 instanceof Double){
			if( v2==null || ((Double)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Double)v2));
		}
		// FLOAT
		else if(v2 instanceof Float){
			if( v2==null || ((Float)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Float)v2));
		}
		// STRING
		else if(v2 instanceof String){
			if( v2==null || ((String)v2).length()&lt;1 || 

!validate.valida((String)v2, KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v2 instanceof BigDecimal){
			if( v2==null || 

((BigDecimal)v2).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v2).toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigDecimal)v2)); 
		}
		// BIGINTEGER
		else if(v2 instanceof BigInteger){
			if( v2==null || 

!validate.valida(v2.toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigInteger)v2)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v2 instanceof Object){
			v2 = &quot;0&quot;;
		}
		int retorno = new 

BigDecimal((String)v1).compareTo((new BigDecimal((String)v2)));
		if(retorno==1){
			return false;
		}
		else {
			int retorno2 = new 

BigDecimal((String)v2).compareTo((new BigDecimal((String)v1)));
			if(retorno2==1){
				return false;
			}
		}
		return true;
	}
	
	/**
	 * RETORNA A PARTE INTEIRA DE UM OBJETO
	 * @param v1 Objeto de valor
	 * @return BigDecimal com a parte inteira do objeto
	 */
	public static BigDecimal getParteInteira(Object v1){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new BigDecimal(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new BigInteger(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		if(v1.equals(&quot;.&quot;)){
			v1= new String(&quot;0&quot;);
		}
		
		BigDecimal bigDecimalObjectAux = new 

BigDecimal((String)v1);
		BigInteger valorOriginalInteiroAux = 

bigDecimalObjectAux.toBigInteger();
		return new 

BigDecimal(valorOriginalInteiroAux.toString());
	}
	
	
	/**
	 * RETORNA A PARTE INTEIRA DE UM OBJETO
	 * @param v1 Objeto de valor
	 * @return BigDecimal com a parte inteira do objeto
	 */
	public static String getParteInteira(Object v1, int 

casasDecimais){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new BigDecimal(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new BigInteger(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		if(v1.equals(&quot;.&quot;)){
			v1= new String(&quot;0&quot;);
		}
		
		BigDecimal bigDecimalObjectAux = new 

BigDecimal((String)v1);
		BigInteger valorOriginalInteiroAux = 

bigDecimalObjectAux.toBigInteger();
		
		String retorno = valorOriginalInteiroAux.toString();
		
		while(retorno.length() &lt; casasDecimais){
			retorno= &quot;0&quot; + retorno;
		}
		
		return retorno;
	}
	
	/**
	 * 
	 * @param v1
	 * @param casasDecimais
	 * @return
	 */
	public static String getParteCentavos(Object v1, int 

casasDecimais){
		
		if(v1.equals(&quot;.&quot;)){
			v1= new String(&quot;0&quot;);
		}
		
		if(casasDecimais&lt;0){
			casasDecimais*=-1;
		}
		else if(casasDecimais==0){
			casasDecimais=1;
		}
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
			while(v1.toString().length()&lt;casasDecimais){
				v1 = "0" + v1;
			}
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&gt;&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		BigDecimal bigDecimalObjectAux = new 

BigDecimal((String)v1);
		BigDecimal bigDecimalCentavos = 

bigDecimalObjectAux.subtract(getParteInteira(bigDecimalObjectAux));
		
		
		String centavos = bigDecimalCentavos.toString();
		
		if(bigDecimalCentavos.signum()==1){
			if(centavos.length()&lt;casasDecimais-2){
				centavos=new 

String(centavos.substring(2,centavos.length()));
			}
			
			if(centavos.length()&gt;casasDecimais-2){
					centavos=new 

String(centavos.substring(2,centavos.length()));
			}
			if(casasDecimais&gt;centavos.length()){
				

while(casasDecimais&gt;centavos.length()){
					centavos += &quot;0&quot;;
				}
			}
		}
		else if(bigDecimalCentavos.signum()==-1){
			if(centavos.length()&lt;casasDecimais-3){
				centavos=new 

String(centavos.substring(3,centavos.length()));
			}
			
			if(centavos.length()&gt;casasDecimais-3){
					centavos=new 

String(centavos.substring(3,centavos.length())).substring(0,casasDecim

ais);
			}
			if(casasDecimais&gt;centavos.length()){
				

while(casasDecimais&gt;centavos.length()){
					centavos += &quot;0&quot;;
				}
			}
		}
		else if(bigDecimalCentavos.signum()==0){
			centavos = &quot;&quot;;
			for(int i=0;i&lt;casasDecimais;i++){
				centavos+="0";
			}
		}
		centavos = centavos.substring(0,casasDecimais);
		String theRetorno = "0";
		BigDecimal retorno = new BigDecimal(0);
		try{
			retorno = new BigDecimal(centavos);
			theRetorno = retorno.toString();
			if(Integer.parseInt(theRetorno)==0 ){
				

while(theRetorno.length()&gt;&lt;casasDecimais){
					theRetorno = "0" + theRetorno;
				}
			}
			
			if(theRetorno.length()&gt;&lt;casasDecimais){
				theRetorno = "0" + theRetorno;
			}
		}
		catch(Exception e){
			theRetorno = "0";
			while(theRetorno.length()&gt;&lt;casasDecimais){
				theRetorno = "0" + theRetorno;
			}
		}
		
		return theRetorno;
	}
	
	/**
	 * soma dois objetos
	 * @param v1 primeiro objeto
	 * @param v2 segundo objeto
	 * @return a soma dos objetos
	 */
	public static BigDecimal somar(Object v1, Object v2){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String("0");
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&gt;&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		// NULL
		if(v2==null){
			v2 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v2 instanceof Integer){
			if( v2==null || ((Integer)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Integer)v2));
		}
		// DOUBLE
		else if(v2 instanceof Double){
			if( v2==null || ((Double)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Double)v2));
		}
		// FLOAT
		else if(v2 instanceof Float){
			if( v2==null || ((Float)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Float)v2));
		}
		// STRING
		else if(v2 instanceof String){
			if( v2==null || ((String)v2).length()&lt;1 || 

!validate.valida((String)v2, KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v2 instanceof BigDecimal){
			if( v2==null || 

((BigDecimal)v2).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v2).toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigDecimal)v2)); 
		}
		// BIGINTEGER
		else if(v2 instanceof BigInteger){
			if( v2==null || 

!validate.valida(v2.toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigInteger)v2)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v2 instanceof Object){
			v2 = &quot;0&quot;;
		}
		BigDecimal retorno = new BigDecimal(&quot;0&quot;);
		retorno = new BigDecimal((String)v1).add(new 

BigDecimal((String)v2));
		return retorno;
	}
	
	/**
	 * subtrai o primeiro pelo segundo objeto
	 * @param v1 primeiro objeto
	 * @param v2 segundo objeto
	 * @return a soma dos objetos
	 */
	public static BigDecimal subtrair(Object v1, Object v2){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		// NULL
		if(v2==null){
			v2 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v2 instanceof Integer){
			if( v2==null || ((Integer)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Integer)v2));
		}
		// DOUBLE
		else if(v2 instanceof Double){
			if( v2==null || ((Double)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Double)v2));
		}
		// FLOAT
		else if(v2 instanceof Float){
			if( v2==null || ((Float)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Float)v2));
		}
		// STRING
		else if(v2 instanceof String){
			if( v2==null || ((String)v2).length()&lt;1 || 

!validate.valida((String)v2, KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v2 instanceof BigDecimal){
			if( v2==null || 

((BigDecimal)v2).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v2).toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigDecimal)v2)); 
		}
		// BIGINTEGER
		else if(v2 instanceof BigInteger){
			if( v2==null || 

!validate.valida(v2.toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigInteger)v2)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v2 instanceof Object){
			v2 = &quot;0&quot;;
		}
		BigDecimal retorno = new BigDecimal(&quot;0&quot;);
		retorno = new BigDecimal((String)v1).subtract(new 

BigDecimal((String)v2));
		return retorno;
	}
	
	/**
	 * multiplica o primeiro pelo segundo objeto
	 * @param v1 primeiro objeto
	 * @param v2 segundo objeto
	 * @return a soma dos objetos
	 */
	public static BigDecimal multiplicar(Object v1, Object v2){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		// NULL
		if(v2==null){
			v2 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v2 instanceof Integer){
			if( v2==null || ((Integer)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Integer)v2));
		}
		// DOUBLE
		else if(v2 instanceof Double){
			if( v2==null || ((Double)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Double)v2));
		}
		// FLOAT
		else if(v2 instanceof Float){
			if( v2==null || ((Float)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Float)v2));
		}
		// STRING
		else if(v2 instanceof String){
			if( v2==null || ((String)v2).length()&lt;1 || 

!validate.valida((String)v2, KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v2 instanceof BigDecimal){
			if( v2==null || 

((BigDecimal)v2).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v2).toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigDecimal)v2)); 
		}
		// BIGINTEGER
		else if(v2 instanceof BigInteger){
			if( v2==null || 

!validate.valida(v2.toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigInteger)v2)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v2 instanceof Object){
			v2 = &quot;0&quot;;
		}
		BigDecimal retorno = new BigDecimal(&quot;0&quot;);
		retorno = new BigDecimal((String)v1).multiply(new 

BigDecimal((String)v2));
		return retorno;
	}
	
	/**
	 * divide o primeiro pelo segundo objeto
	 * @param v1 primeiro objeto
	 * @param v2 segundo objeto
	 * @return a soma dos objetos
	 */
	public static String dividir(Object v1, Object v2){
		KubicValidate validate = new KubicValidate();
		// NULL
		if(v1==null){
			v1 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v1 instanceof Integer){
			if( v1==null || ((Integer)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Integer)v1));
		}
		// DOUBLE
		else if(v1 instanceof Double){
			if( v1==null || ((Double)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Double)v1));
		}
		// FLOAT
		else if(v1 instanceof Float){
			if( v1==null || ((Float)v1).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new String(String.valueOf((Float)v1));
		}
		// STRING
		else if(v1 instanceof String){
			if( v1==null || ((String)v1).length()&lt;1 || 

!validate.valida((String)v1, KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v1 instanceof BigDecimal){
			if( v1==null || 

((BigDecimal)v1).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1).toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigDecimal)v1)); 
		}
		// BIGINTEGER
		else if(v1 instanceof BigInteger){
			if( v1==null || 

!validate.valida(v1.toString(), KubicValidate.money)){
				v1 = new String(&quot;0&quot;);
			}
			v1 = new 

String(String.valueOf((BigInteger)v1)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v1 instanceof Object){
			v1 =  new String(&quot;0&quot;);
		}
		
		// NULL
		if(v2==null){
			v2 = new String(&quot;0&quot;);
		}
		// INTEGER
		else if(v2 instanceof Integer){
			if( v2==null || ((Integer)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Integer)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Integer)v2));
		}
		// DOUBLE
		else if(v2 instanceof Double){
			if( v2==null || ((Double)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Double)v2));
		}
		// FLOAT
		else if(v2 instanceof Float){
			if( v2==null || ((Float)v2).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v2), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new String(String.valueOf((Float)v2));
		}
		// STRING
		else if(v2 instanceof String){
			if( v2==null || ((String)v2).length()&lt;1 || 

!validate.valida((String)v2, KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
		}
		// BIGDECIMAL
		else if(v2 instanceof BigDecimal){
			if( v2==null || 

((BigDecimal)v2).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v2).toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigDecimal)v2)); 
		}
		// BIGINTEGER
		else if(v2 instanceof BigInteger){
			if( v2==null || 

!validate.valida(v2.toString(), KubicValidate.money)){
				v2 = new String(&quot;0&quot;);
			}
			v2 = new 

String(String.valueOf((BigInteger)v2)); 
		}
		// OUTROS CASOS RETORNA zero
		else if(v2 instanceof Object){
			v2 = &quot;0&quot;;
		}
		String retorno = null;
		try{
			//retorno = new 

BigDecimal((String)v1).divide(new BigDecimal((String)v2));
			retorno = String.valueOf((new 

Float((String)v1) / new Float((String)v2)));
		}
		catch(java.lang.ArithmeticException e){
			System.out.println(&quot;divisao por 0&quot;);
			retorno = null;
		}
		return retorno;
	}
	
	/**
	 * soma um array de objetos
	 * @param v1
	 * @return
	 */
	public static BigDecimal somar(Object []v1){
		
		KubicValidate validate = new KubicValidate();
		// NULL OBJECT
		if(v1==null){
			return new BigDecimal(&quot;0&quot;);
		}
		// PERCORRE OBJETOS
		for(int i=0;i&lt;v1.length;i++){
			// NULL IN ARRAY
			if(v1[i]==null){
				v1[i] = new String("0");
			}
			// INTEGER
			else if(v1[i] instanceof Integer){
				if( v1[i]==null || 

((Integer)v1[i]).SIZE&gt;&lt;1 || 

!validate.valida(String.valueOf((Integer)v1[i]), 

KubicValidate.money)){
					v1[i] = new String(&quot;0&quot;);
				}
				v1[i] = new 

String(String.valueOf((Integer)v1[i]));
			}
			// DOUBLE
			else if(v1[i] instanceof Double){
				if( v1[i]==null || 

((Double)v1[i]).SIZE&lt;1 || 

!validate.valida(String.valueOf((Double)v1[i]), KubicValidate.money)){
					v1[i] = new String(&quot;0&quot;);
				}
				v1[i] = new 

String(String.valueOf((Double)v1[i]));
			}
			// FLOAT
			else if(v1[i] instanceof Float){
				if( v1[i]==null || 

((Float)v1[i]).SIZE&lt;1 || 

!validate.valida(String.valueOf((Float)v1[i]), KubicValidate.money)){
					v1[i] = new String(&quot;0&quot;);
				}
				v1[i] = new 

String(String.valueOf((Float)v1[i]));
			}
			// STRING
			else if(v1[i] instanceof String){
				if( v1[i]==null || 

((String)v1[i]).length()&lt;1 || !validate.valida((String)v1[i], 

KubicValidate.money)){
					v1[i] = new String(&quot;0&quot;);
				}
			}
			// BIGDECIMAL
			else if(v1[i] instanceof BigDecimal){
				if( v1[i]==null || 

((BigDecimal)v1[i]).toString().length()&lt;1 || 

!validate.valida(((BigDecimal)v1[i]).toString(), 

KubicValidate.money)){
					v1[i] = new String(&quot;0&quot;);
				}
				v1[i] = new 

String(String.valueOf((BigDecimal)v1[i])); 
			}
			// BIGINTEGER
			else if(v1[i] instanceof BigInteger){
				if( v1[i]==null || 

!validate.valida(v1[i].toString(), KubicValidate.money)){
					v1[i] = new String(&quot;0&quot;);
				}
				v1[i] = new 

String(String.valueOf((BigInteger)v1[i])); 
			}
			// OUTROS CASOS RETORNA zero
			else{
				return new BigDecimal(&quot;0&quot;);
			}
		}
		BigDecimal retorno = new BigDecimal(&quot;0&quot;);
		for(int i=0;i&lt;v1.length;i++){
			retorno = retorno.add(new 

BigDecimal((String)v1[i]));
		}
		return retorno;
	}
	
	
}

>

O grade “segredo” de tudo é o método paint …

Se este exemplo resolver, peço encarecidamente q avise …