Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static final String RAND_STRING = "1gCBizHWbwIYyWLoysGzTe6SyzqFKMniZX05faZHWAwQKXf6Fs";
    public static final int MAX_PWD_LENGTH = 50;

    /**
     * @param newPassword
     * @return
     */
    public static String padPasswordWithRandomStringData(final String newPassword) {
        int lCopy = MAX_PWD_LENGTH - 10 - newPassword.length();
        StringBuilder pwdBuf = new StringBuilder();
        pwdBuf.append(newPassword);

        if (lCopy > 15) {
            pwdBuf.append(RAND_STRING.substring(0, lCopy));
        }

        String randPaddedNewPassword = pwdBuf.toString();
        return randPaddedNewPassword;
    }
}