All pastes #910096 Raw Edit

Converter decimal em Binrio

public java v1 · immutable
·published 2008-02-19 19:04 UTC
rendered paste body
/* * Aula: 14/fev/2008 * * Converter valor decimal em Binário; * */public class NumeroBIN {        public void convertBIN (int valor) {        int aux = valor;        int mod = valor;                String bin = "";                while (aux > 0) {                        aux = aux /2;            mod = mod % 2;                        bin = mod +""+bin;            mod = aux;                }                System.out.println("convertendo... ");        System.out.println(valor+" em binário é '"+bin+"'");            }}