title: How would I format my binary in 4 bit groups after my binary conversion program in Java?
body: <pre><code>import java.util.*;
  
  public class Binary {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          Scanner input = new Scanner(System.in);
  
          int number = input.nextInt();
          String binary = Integer.toBinaryString(number);
          System.out.println(binary);
  
      }
  
  }
  </code></pre>
  <p>I am trying to create a program which converts an integer into binary and groups every four bits. For example, if I input 1, I want to get 0001, but I get 1</p>