All pastes #904991 Raw Edit

Convert valor decimal para Bin

public java v1 · immutable
·published 2008-02-15 13:50 UTC
rendered paste body
/*  * 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+"'");                }}