Here you can find the source of integerToBinaryString(int value)
public static String integerToBinaryString(int value)
//package com.java2s; /**//from w w w. j a v a 2 s . co m * Copyright (c) 2014 Sa?l Pi?a <sauljabin@gmail.com>. * * This file is part of GeneticAlgorithm. * * GeneticAlgorithm is licensed under The MIT License. * For full copyright and license information please see the LICENSE file. */ public class Main { public static String integerToBinaryString(int value) { return (value < 0 ? "1" : "0") + Integer.toBinaryString(Math.abs(value)); } public static String integerToBinaryString(int value, int size) { return (value < 0 ? "1" : "0") + String.format("%" + (size - 1) + "s", Integer.toBinaryString(Math.abs(value))).replace( " ", "0"); } }