Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. public class umwandler {
  2.    
  3.     public static void main(String[]args){
  4.    
  5.         int zaehler = 3;
  6.         int dezimalzahl =  Integer.parseInt(args[0]);
  7.         int counter = 0;
  8.         int rest = 0;
  9.        
  10.         while (dezimalzahl >=1){
  11.    
  12.        
  13.         rest = dezimalzahl%2;
  14.        
  15.         dezimalzahl =dezimalzahl/2;
  16.        
  17.         counter++;
  18.                    
  19.         }
  20.                    
  21.         rest = 0;
  22.         int array[] = new int[counter];
  23.        
  24.        
  25.         while (dezimalzahl > 1){
  26.            
  27.        
  28.         dezimalzahl =dezimalzahl/2;
  29.        
  30.         array [zaehler] = dezimalzahl%2;
  31.        
  32.         zaehler--;
  33.        
  34.         }
  35.            
  36.            
  37.     }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement