org.bouncycastle.util.Arrays.getLength()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中org.bouncycastle.util.Arrays.getLength()方法的一些代码示例,展示了Arrays.getLength()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arrays.getLength()方法的具体详情如下:
包路径:org.bouncycastle.util.Arrays
类名称:Arrays
方法名:getLength

Arrays.getLength介绍

暂无

代码示例

代码示例来源:origin: redfish64/TinyTravelTracker

public static BigInteger[] copyOfRange(BigInteger[] data, int from, int to)
{
  int newLength = getLength(from, to);
  BigInteger[] tmp = new BigInteger[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static long[] copyOfRange(long[] data, int from, int to)
{
  int newLength = getLength(from, to);
  long[] tmp = new long[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static int[] copyOfRange(int[] data, int from, int to)
{
  int newLength = getLength(from, to);
  int[] tmp = new int[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static BigInteger[] copyOfRange(BigInteger[] data, int from, int to)
{
  int newLength = getLength(from, to);
  BigInteger[] tmp = new BigInteger[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: redfish64/TinyTravelTracker

public static int[] copyOfRange(int[] data, int from, int to)
{
  int newLength = getLength(from, to);
  int[] tmp = new int[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: redfish64/TinyTravelTracker

public static long[] copyOfRange(long[] data, int from, int to)
{
  int newLength = getLength(from, to);
  long[] tmp = new long[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Make a copy of a range of bytes from the passed in data array. The range can
 * extend beyond the end of the input array, in which case the return array will
 * be padded with zeroes.
 *
 * @param data the array from which the data is to be copied.
 * @param from the start index at which the copying should take place.
 * @param to the final index of the range (exclusive).
 *
 * @return a new byte array containing the range given.
 */
public static byte[] copyOfRange(byte[] data, int from, int to)
{
  int newLength = getLength(from, to);
  byte[] tmp = new byte[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * Make a copy of a range of bytes from the passed in data array. The range can
 * extend beyond the end of the input array, in which case the return array will
 * be padded with zeroes.
 *
 * @param data the array from which the data is to be copied.
 * @param from the start index at which the copying should take place.
 * @param to the final index of the range (exclusive).
 *
 * @return a new byte array containing the range given.
 */
public static byte[] copyOfRange(byte[] data, int from, int to)
{
  int newLength = getLength(from, to);
  byte[] tmp = new byte[newLength];
  if (data.length - from < newLength)
  {
    System.arraycopy(data, from, tmp, 0, data.length - from);
  }
  else
  {
    System.arraycopy(data, from, tmp, 0, newLength);
  }
  return tmp;
}

相关文章