Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String appendZeros(String binaryNum) {
        int len = binaryNum.length();
        if (len % 7 == 0) {
            return binaryNum;
        } else {
            int remainingDiff = (len % 7);
            int diff = 7 - remainingDiff;
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < diff; i++) {
                sb.append(0);
            }
            sb.append(binaryNum);
            return sb.toString();
        }
    }
}