Java Zero Format zeroAlign(String x, int count)

Here you can find the source of zeroAlign(String x, int count)

Description

zero Align

License

Open Source License

Declaration

static String zeroAlign(String x, int count) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static String zeroAlign(String x, int count) {
        if (x.length() < count) {
            int spaces = count - x.length();
            StringBuilder result = new StringBuilder(count);
            while (spaces > 0) {
                result.append("0");
                spaces--;//from   w  w w .j a  va  2 s.c o m
            }
            result.append(x);
            return result.toString();
        } else {
            return x;
        }
    }
}

Related

  1. zero(byte[]... arrays)
  2. zero(double[] zero)
  3. zero(int bits)
  4. zero(int x)
  5. zero_pad(byte[] original, int block_size)
  6. zeroBasedTemplateStart(final int[] actions)
  7. zeroBlock(byte[] block, int off, int len)
  8. zeroConvert(String src)
  9. zerocount(int v)