java convert integer to binary string

www.l‮.iruttua‬com
java convert integer to binary string
// get a binary string representation of the integer in java
/**
 * @author lautturi.com 
 * Java example: converting integer to binary string 
 */

import java.util.*;

public class Lautturi {

	public static void main(String[] args) {

		int num = 2;
		String str =  Integer.toBinaryString(num);
		
		System.out.println(str);

	}
}

output:

10
Created Time:2017-09-23 20:56:48  Author:lautturi