Returning all rows from an array after a specific index

I made a team that does something for the player. One of the optional arguments for this is to add a reason, and when done, it will be sent to the user.

The problem is that I created the command and the reason is working, so the reason must be written without spaces. (for example, YouWereGreifing!). This is because in the code I only told him to use the argument with the index of the number.

My question is, how would I concatenate an array into a string, but only take values ​​after a certain index in that array.

code Here is the method I am calling:

Main.demotePlayer(player, targetPlayer, "Guest", args[1])

      

and args [] is created with

public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String [] args){

      

+3


source to share


1 answer


Try Arrays.copyOfRange method ?



newarray[] = Arrays.copyOfRange(oldArray, start, oldArray.length);

+3


source







All Articles