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;

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

the thread is marked solved, but I don't see any solution here, so I'll just add a link to the (in my eyes) best solution there is:
decimal to binary