Here you can find the source of removeSomeOne(String words, int count)
public static String removeSomeOne(String words, int count)
//package com.java2s; /*/* w w w. j a va 2s . co m*/ * * ***************************************************************************** * * Copyright ( c ) 2016 Heren Tianjin Inc. All Rights Reserved. * * * * This software is the confidential and proprietary information of Heren Tianjin Inc * * ("Confidential Information"). You shall not disclose such Confidential Information * * and shall use it only in accordance with the terms of the license agreement * * you entered into with Heren Tianjin or a Heren Tianjin authorized * * reseller (the "License Agreement"). * **************************************************************************** * */ import java.util.Arrays; public class Main { public static String removeSomeOne(String words, int count) { String[] word = words.split("\\^"); int wordsLength = word.length; if (count < wordsLength) { System.arraycopy(word, count + 1, word, count, wordsLength - 1 - count); String[] newWords = Arrays.copyOf(word, wordsLength - 1); StringBuilder sb = new StringBuilder(); for (String newWord : newWords) { sb.append(newWord).append("^"); } return sb.toString().substring(0, sb.length() - 1); } else { return words; } } }