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 putInString(String source, String placement, int gap) {
        StringBuilder builder = new StringBuilder();
        int i = 0;
        while (i + gap < source.length()) {
            builder.append(source.substring(i, i + gap));
            builder.append(placement);
            i += gap;
        }
        builder.append(source.substring(i));
        return builder.toString();
    }
}