List of usage examples for java.util Arrays copyOf
public static boolean[] copyOf(boolean[] original, int newLength)
From source file:com.offbynull.peernetic.playground.chorddht.messages.external.FindSuccessorRequest.java
public FindSuccessorRequest(byte[] id) { this.id = Arrays.copyOf(id, id.length); validate(); }
From source file:fr.ortolang.diffusion.security.authentication.TOTPHelper.java
public static String generateSecret() { byte[] buffer = new byte[20]; rand.nextBytes(buffer);// w ww. j av a 2s . c o m Base32 codec = new Base32(); byte[] secretKey = Arrays.copyOf(buffer, 20); byte[] encodedKey = codec.encode(secretKey); return new String(encodedKey); }
From source file:com.xiantrimble.combinatorics.CombMathUtilsBenchmark.java
@Override public long c(int k, int... m) { // sort m//from w ww . j a v a 2s . c om int[] mSorted = Arrays.copyOf(m, m.length); Arrays.sort(mSorted); // group the distinct values. ArrayList<DistinctM> distinctMs = new ArrayList<DistinctM>(); for (int i = mSorted.length - 1; i >= 0;) { int count = 1; for (; i - count >= 0 && mSorted[i] == mSorted[i - count]; count++) ; distinctMs.add(new DistinctM(mSorted[i], count)); i -= count; } return c(k, distinctMs.toArray(new DistinctM[distinctMs.size()])); }
From source file:io.pravega.controller.task.TaskData.java
public Serializable[] getParameters() { return Arrays.copyOf(parameters, parameters.length); }
From source file:libepg.util.bytearray.ByteDataBlock.java
public ByteDataBlock(byte[] data) throws NullPointerException { if (data == null) { throw new NullPointerException("???????????"); }/* www . j a v a 2 s . co m*/ //? this.data = Arrays.copyOf(data, data.length); }
From source file:com.offbynull.peernetic.playground.chorddht.messages.external.FindSuccessorResponse.java
public byte[] getId() { return id != null ? Arrays.copyOf(id, id.length) : null; }
From source file:com.google.nigori.server.JUser.java
public JUser(byte[] publicKey, byte[] publicHash, Date registrationDate) { this.publicKey = Arrays.copyOf(publicKey, publicKey.length); this.publicHash = Arrays.copyOf(publicHash, publicHash.length); this.registrationDate = registrationDate; }
From source file:com.opengamma.maths.lowlevelapi.functions.utilities.Reverse.java
/** * Reverses a vector in place//from w w w. jav a 2 s . co m * @param v1 the vector to be reversed * @return r a reversed copy of v1 */ public static int[] stateless(int[] v1) { Validate.notNull(v1); int[] r = Arrays.copyOf(v1, v1.length); inPlace(r); return r; }
From source file:com.offbynull.peernetic.playground.chorddht.messages.external.FindSuccessorRequest.java
public byte[] getId() { return Arrays.copyOf(id, id.length); }
From source file:org.leandreck.endpoints.processor.model.RequestMapping.java
public RequestMethod[] method() { return Arrays.copyOf(method, method.length); }