List of usage examples for java.util Arrays copyOfRange
@HotSpotIntrinsicCandidate public static <T, U> T[] copyOfRange(U[] original, int from, int to, Class<? extends T[]> newType)
From source file:Main.java
public static void main(String[] args) { // intializing an array arr1 Short arr1[] = new Short[] { 15, 10, 45 }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 as Number with range of index from 1 to 3 Number[] arr2 = Arrays.copyOfRange(arr1, 1, 3, Number[].class); System.out.println(Arrays.toString(arr2)); }
From source file:io.janusproject.Boot.java
/** Main function that is parsing the command line and launching * the first agent./* w ww . jav a2s .com*/ * * @param args - command line arguments * @see #startJanus(Class, Class, Object...) */ public static void main(String[] args) { try { List<URL> propertyFiles = new ArrayList<>(); Object[] freeArgs = parseCommandLine(args, propertyFiles); if (JanusConfig.getSystemPropertyAsBoolean(JanusConfig.JANUS_LOGO_SHOW_NAME, JanusConfig.JANUS_LOGO_SHOW)) { showJanusLogo(); } if (freeArgs.length == 0) { showError(Locale.getString("NO_AGENT_QUALIFIED_NAME"), //$NON-NLS-1$ null); } String agentToLaunch = freeArgs[0].toString(); freeArgs = Arrays.copyOfRange(freeArgs, 1, freeArgs.length, String[].class); // Load the agent class Class<? extends Agent> agent = loadAgentClass(agentToLaunch); assert (agent != null); // Load property files Properties systemProperties = System.getProperties(); for (URL url : propertyFiles) { try (InputStream stream = url.openStream()) { systemProperties.load(stream); } } // Set the boot agent classname System.setProperty(JanusConfig.BOOT_AGENT, agent.getCanonicalName()); startJanus(null, (Class<? extends Agent>) agent, freeArgs); } catch (Exception e) { showError(Locale.getString("LAUNCHING_ERROR", //$NON-NLS-1$ e.getLocalizedMessage()), e); return; } }
From source file:com.goncalomb.bukkit.nbteditor.nbt.MobNBT.java
public float[] getDropChances() { if (_data.hasKey("DropChances")) { return ArrayUtils .toPrimitive(Arrays.copyOfRange(_data.getListAsArray("DropChances"), 0, 5, Float[].class)); }/*from w w w . j av a 2 s .c o m*/ return null; }
From source file:ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.java
/** * Constructor/*from w w w . j a v a2 s .co m*/ * * @param theStatusCode * The HTTP status code corresponding to this problem * @param theMessages * The messages */ public BaseServerResponseException(int theStatusCode, String... theMessages) { super(theMessages != null && theMessages.length > 0 ? theMessages[0] : null); myStatusCode = theStatusCode; myBaseOperationOutcome = null; if (theMessages != null && theMessages.length > 1) { myAdditionalMessages = Arrays .asList(Arrays.copyOfRange(theMessages, 1, theMessages.length, String[].class)); } }