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 fillStringByBytes(String strValue, char ch, int iSign) {
        try {
            StringBuffer strTemp = new StringBuffer();
            int iDifference = iSign - strValue.getBytes().length;
            if (iDifference <= 0)
                return strValue;
            for (int i = 0; i < iDifference; i++)
                strTemp.append(ch);
            strTemp.append(strValue);
            return strTemp.toString();
        } catch (Exception ex) {
            return "";
        }
    }
}