Here you can find the source of zeroPadAfterTo(String hex, int i)
public static String zeroPadAfterTo(String hex, int i)
//package com.java2s; //License from project: Open Source License public class Main { public static String zeroPadAfterTo(String hex, int i) { if (hex.length() == i) { return hex; } else if (hex.length() > i) { throw new AssertionError(); }/*from ww w.ja v a2s. co m*/ StringBuilder sb = new StringBuilder(); for (int j = 0; j < i - hex.length(); j++) { sb.append('0'); } String s = hex + sb.toString(); if (s.length() != i) throw new AssertionError(); return s; } }