0
public static String DecBin(int nbr)

    String resultat="";
        String decbin="";
        //String temp;
        int rest;
        //temp="";
        while(n/2>0)
        {
        rest=n%2;
        //temp=temprest;
        String rest1=Integer.toString(rest);
        resultat=resultat+rest1;
        }
        for (int i=resultat.length();i<resultat.length()-1;i--)
            decbin=String.valueOf(resultat.charAt(i));
        return resultat;
2
Contributors
2
Replies
8
Views
3 Years
Discussion Span
Last Post by stultuske
0

i need a method that convert from decimal to binary i tried this code but that print anything;

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.