Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java integer to binary string

int n = 1000;
String s = Integer.toBinaryString(n);
Comment

java int to binary

public static String makeBinaryString(int n) {
	StringBuilder sb = new StringBuilder();
	while (n > 0) {
    sb.append(n % 2);
		n /= 2;
	}
  	sb.reverse();  	
  	return sb.toString();
}
Comment

java decimal to binary converter

public class decToBin{

    static void ab(int iput){
        String output = "";
        if(iput <= 0){
            System.out.println("nope");

        }else{
            int a = iput;
            for(int i = 0; a > 0; i++){
                a = Math.floorDiv(a, 2);
                output = (a % 2) + output;
            }
        }

        String b = "";
        String c = "";
        for (int index = 0; index < output.length(); index++) {
            c = output.charAt(index) + c;
        }

        System.out.println(c);
    }




    public static void main(String[] args) {
        System.out.println("test..");
        ab(50);
    }
}
Comment

int to binary java

String binary = Integer.toBinaryString(num);
Comment

integer to binary java

Integer.toString(100,8) // prints 144 --octal representation

Integer.toString(100,2) // prints 1100100 --binary representation

Integer.toString(100,16) //prints 64 --Hex representation
Comment

PREVIOUS NEXT
Code Example
Java :: print a to z in java 
Java :: javafx every second 
Java :: java delete files 
Java :: paper api maven 
Java :: how to add to arras java 
Java :: How to create a union-find data structure, in Java? 
Java :: java coding standards variables 
Java :: Java forName() method 
Java :: how to get the last element of array in java 
Java :: java convert list to page 
Java :: java get current date without time 
Java :: generate a random phone number in java 
Java :: read file in java 
Java :: loop through keys only in hashmap java 
Java :: create file from byte array java 
Java :: mockito verify not called 
Java :: android.permission.INTERNET 
Java :: how to destroy activity in android 
Java :: java sout two dimensional array 
Java :: specify decimal places java 
Java :: create new java swing button 
Java :: java print array as string 
Java :: java charsequence to string 
Java :: Uri from bitmap java android 
Java :: android use attribute color programmatically 
Java :: Error inflating class ImageView 
Java :: android string java 
Java :: bufferedinputstream to byte array 
Java :: java iterate over list 
Java :: java go troght loop object 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =