public static char[] inttochar(int schritte) {
    String data = Integer.toBinaryString(schritte);
    int laenge = data.length();
    char feld[] = {0, 0};
    char summe = 0, anz = 1;

    for (int i = laenge - 1; i >= 0; i--) {
      anz++;

      if (data.charAt(i) == '1') {
        summe += Math.pow(2, laenge - i - 1);
      }
      if (anz == 9) {
        feld[0] = summe;
      }
    }

    data = data.substring(0, laenge - 8);
    laenge = data.length();
    summe = 0;

    for (int i = laenge - 1; i >= 0; i--) {
      if (data.charAt(i) == '1') {
        summe += Math.pow(2, laenge - i - 1);
      }
    }
    feld[1] = summe;

    System.out.println((int) feld[0]);
    System.out.println((int) feld[1]);

    return feld;
  }
Пример #2
0
  public double getShapeRatio(double ratio, int shape) {

    switch (shape) {
        // case CONICAL: return 0.2+0.8*ratio;
        // need real conical shape for lark, fir, etc.
      case CONICAL:
        return ratio; // FIXME: this would be better: 0.05+0.95*ratio; ?
      case SPHERICAL:
        return 0.2 + 0.8 * Math.sin(Math.PI * ratio);
      case HEMISPHERICAL:
        return 0.2 + 0.8 * Math.sin(0.5 * Math.PI * ratio);
      case CYLINDRICAL:
        return 1.0;
      case TAPERED_CYLINDRICAL:
        return 0.5 + 0.5 * ratio;
      case FLAME:
        return ratio <= 0.7 ? ratio / 0.7 : (1 - ratio) / 0.3;
      case INVERSE_CONICAL:
        return 1 - 0.8 * ratio;
      case TEND_FLAME:
        return ratio <= 0.7 ? 0.5 + 0.5 * ratio / 0.7 : 0.5 + 0.5 * (1 - ratio) / 0.3;
      case ENVELOPE:
        if (ratio < 0 || ratio > 1) {
          return 0;
        } else if (ratio < (1 - PruneWidthPeak)) {
          return Math.pow(ratio / (1 - PruneWidthPeak), PrunePowerHigh);
        } else {
          return Math.pow((1 - ratio) / (1 - PruneWidthPeak), PrunePowerLow);
        }
        // tested in prepare() default: throw new ErrorParam("Shape must be between 0 and 8");
    }
    return 0; // shouldn't reach here
  }
Пример #3
0
  public double getHu2(int region) {

    double eta20 = this.getEta(region, 2, 0);
    double eta02 = this.getEta(region, 0, 2);
    double eta11 = this.getEta(region, 1, 1);
    return Math.pow(eta20 - eta02, 2) + Math.pow(2 * eta11, 2);
  }
 double oblicz_wage(int x1, int y1, int x2, int y2) {
   double x = (double) Math.pow(Math.abs((x1 - x2)), 2);
   double y = (double) Math.pow(Math.abs((y1 - y2)), 2);
   double wynik = Math.sqrt(x + y) * 1000;
   wynik = Math.round(wynik);
   return (wynik / 1000);
 }
Пример #5
0
  private void spawnRandomers() {
    for (int i = 0; i < randomN; i++) {
      float x = (float) Math.random() * width;
      float y = (float) Math.random() * height;
      float r =
          (float)
              Math.sqrt(
                  Math.pow(((Player) players.get(0)).getX() - x, 2)
                      + Math.pow(((Player) players.get(0)).getY() - x, 2));

      while (r < distanceLimit) {
        x = (float) Math.random() * width;
        y = (float) Math.random() * height;
        r =
            (float)
                Math.sqrt(
                    Math.pow(((Player) players.get(0)).getX() - x, 2)
                        + Math.pow(((Player) players.get(0)).getY() - y, 2));
      }

      enemies.add(new EnemyTypes.Random(x, y, 0.5f, borders));
    }

    spawnRandomersB = false;
  }
Пример #6
0
 public Object getData(final WModelIndex index, int role) {
   if (role != ItemDataRole.DisplayRole) {
     return super.getData(index, role);
   }
   double delta_y = (this.yEnd_ - this.yStart_) / (this.getColumnCount() - 2);
   if (index.getRow() == 0) {
     if (index.getColumn() == 0) {
       return 0.0;
     }
     return this.yStart_ + (index.getColumn() - 1) * delta_y;
   }
   double delta_x = (this.xEnd_ - this.xStart_) / (this.getRowCount() - 2);
   if (index.getColumn() == 0) {
     if (index.getRow() == 0) {
       return 0.0;
     }
     return this.xStart_ + (index.getRow() - 1) * delta_x;
   }
   double x;
   double y;
   y = this.yStart_ + (index.getColumn() - 1) * delta_y;
   x = this.xStart_ + (index.getRow() - 1) * delta_x;
   return 4
       * Math.sin(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)))
       / Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
 }
Пример #7
0
 public double nextDouble() {
   int c = read();
   while (isSpaceChar(c)) c = read();
   int sgn = 1;
   if (c == '-') {
     sgn = -1;
     c = read();
   }
   double res = 0;
   while (!isSpaceChar(c) && c != '.') {
     if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt());
     if (c < '0' || c > '9') throw new InputMismatchException();
     res *= 10;
     res += c - '0';
     c = read();
   }
   if (c == '.') {
     c = read();
     double m = 1;
     while (!isSpaceChar(c)) {
       if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt());
       if (c < '0' || c > '9') throw new InputMismatchException();
       m /= 10;
       res += (c - '0') * m;
       c = read();
     }
   }
   return res * sgn;
 }
Пример #8
0
 /** Computes the power for each of the Spectrogram.SAMPLE_SIZE/2 frequency bins. */
 private void computePower() {
   for (int i = 0; i < Spectrogram.SAMPLE_SIZE; i += 2) {
     double ai = Math.pow(transformedSamples[i], 2);
     double bi = Math.pow(transformedSamples[i + 1], 2);
     double power = ai + bi;
     power = Math.sqrt(power);
     freqPower[i / 2] = power;
   }
 }
Пример #9
0
 public int trailingZeroes(int n) {
   int sum = 0;
   int count = 1;
   while ((n / Math.pow(5, count)) >= 1) {
     sum = sum + n / (int) Math.pow(5, count);
     count = count + 1;
   }
   return sum;
 }
Пример #10
0
  /**
   * Calculates word order similarity between the sentences, with weighted words
   *
   * @param s1 sentence 1
   * @param s2 sentence 2
   * @param weights1 of sentence 1
   * @param weights2 of sentence 2
   * @return Word order similarity value
   */
  public double orderSimilarity(
      List<double[]> s1,
      List<double[]> s2,
      List<double[]> weights1,
      List<double[]> weights2,
      String sent2,
      String unique) {
    double[] s1Dist = s1.get(0);
    double[] s1Friend = s1.get(1);
    double[] s2Dist = s2.get(0);
    double[] s2Friend = s2.get(1);
    double[] r1 = new double[s1Dist.length];
    double[] r2 = new double[s2Dist.length];
    String[] sent = sent2.split(" ");
    String[] un = unique.split(" ");
    String word;

    // Specifies word order vectors for either sentence.
    // Threshold specifies that words can be seen as the same if similar enough
    // If same word not found in unique sentence, the order value is 0
    for (int i = 0; i < r1.length; i++) {
      if (s1Dist[i] == 1.0) {
        r1[i] = i + 1;
      } else if (s1Dist[i] >= threshold) {
        r1[i] = s1Friend[i] + 1;

      } else {
        r1[i] = 0;
      }
    }
    for (int i = 0; i < r2.length; i++) {
      if (s2Dist[i] == 1.0) {
        word = un[i];
        r2[i] = Arrays.asList(sent).indexOf(word) + 1;
      } else if (s2Dist[i] >= threshold) {
        r2[i] = s2Friend[i] + 1;

      } else {
        r2[i] = 0.0;
      }
    }
    double numerator = 0.0;
    double denominator = 0.0;
    // Calculate order similarity while avoiding division by 0
    for (int i = 0; i < r1.length; i++) {
      numerator = numerator + Math.pow((r1[i] - r2[i]) * weights1.get(0)[i], 2);
      denominator = denominator + Math.pow((r1[i] + r2[i]) * weights1.get(0)[i], 2);
    }
    numerator = Math.sqrt(numerator);
    denominator = Math.sqrt(denominator);
    if (denominator == 0.0) {
      numerator = 1;
      denominator = 1;
    }

    return numerator / denominator;
  }
Пример #11
0
    protected static double Distance(List<Double> p1, List<Double> p2) {
      double sumOfSquaredDifferences = 0.0;

      for (int i = 0; i < p1.size(); i++) {
        sumOfSquaredDifferences += Math.pow(p1.get(i) - p2.get(i), 2.0);
      }

      return Math.pow(sumOfSquaredDifferences, 0.5);
    }
Пример #12
0
  public static void main(String[] args) throws Throwable {
    double begin = System.currentTimeMillis();
    /*File file = new File(args[0]);
    BufferedReader buffer = new BufferedReader(new FileReader(file));
    String line;
    while ((line = buffer.readLine()) != null) {
        int digits = Integer.parseInt(line);
        */
    int digits = 10;
    int count = 1;
    int iterations = 0;
    int limit = (int) Math.pow((double) 10, (double) digits);
    // start at the first lucky number besides 0 for 6 digits: 0 0 1 | 0 0 1
    int start = (int) Math.pow((double) 10, (double) (digits / 2));
    System.out.println("start: " + start + " and limit: " + limit);
    for (int i = start + 1; i < limit; i++) {
      iterations++;
      int current = i;
      int[] number = new int[digits];
      int len = number.length;

      int index = len - 1;
      // populate array with values
      while (current > 0) {
        number[index] = current % 10;
        current /= 10;
        index--;
      }

      if (!sidesEqual(number)) continue;
      // percentage of "hits" is very small. this way it only runs the sidesEqual method once
      // instead of twice
      /*
       * Step 2: Test that each side is equal. If they are, and the last digit is 0, proceed normally
       */
      else if (sidesEqual(number) && number[len - 1] == 0) {
        // System.out.println("sides match and last digit 0");
        count++;
      }

      /*
       * Step 2b: If both sides match but the last digit is NOT ZERO,
       * then the next occurance (if it exists) will be exactly 9 numbers after the current i
       */

      else if (sidesEqual(number)) {
        // System.out.println("Sides match, last digit is not zero");
        count++;
        i += 8; // (8 since 1 will be added at the end of this iteration or for loop)
      }
    } // end for loop

    System.out.println("count: " + count + " and iterations: " + iterations);
    // } //end while
    System.out.println("runtime in seconds: " + (System.currentTimeMillis() - begin) / 1000);
  } // end main method
Пример #13
0
 public boolean chiSquareEvenDf1(int ob1, int ob2, double chiValueCutoff) {
   double o1 = (double) ob1;
   double o2 = (double) ob2;
   double ex = (o1 + o2) / 2;
   double chi = Math.pow(o1 - ex, 2) / ex + Math.pow(o2 - ex, 2) / ex;
   if (chi > chiValueCutoff) {
     return true;
   }
   return false;
 }
 /**
  * Calculates a number of births on the basis of rates, using Poisson distributed num of events
  *
  * @param lambda rate
  * @return the number of births
  */
 int numberOfBirths(double lambda) {
   double L = 0.0;
   double U = gen.nextDouble();
   double factB = 1.0;
   for (int b = 0; b < 8; b++) {
     if (b > 0) factB = factB * b;
     L = L + Math.pow(lambda * tau, (double) b) * Math.pow(Math.E, -lambda * tau) / factB;
     if (L >= U) return b;
   }
   return 8; // size of Moore neighbourhood
 }
Пример #15
0
 public boolean chiSquareDf1(int ob1, int ob2, int ex1, int ex2, double chiValueCutoff) {
   double o1 = (double) ob1 / (double) (ob1 + ob2);
   double o2 = (double) ob2 / (double) (ob1 + ob2);
   double e1 = (double) ex1 / (double) (ex1 + ex2);
   double e2 = (double) ex2 / (double) (ex1 + ex2);
   double chi = Math.pow(o1 - e1, 2) / e1 + Math.pow(o2 - e2, 2) / e2;
   if (chi > chiValueCutoff) {
     return true;
   }
   return false;
 }
Пример #16
0
  public double getMinDist(final MyRegion r) {
    double ret = 0.0;

    if (r.m_xmin < m_xmin) ret += Math.pow(m_xmin - r.m_xmin, 2.0);
    else if (r.m_xmin > m_xmax) ret += Math.pow(r.m_xmin - m_xmax, 2.0);

    if (r.m_ymin < m_ymin) ret += Math.pow(m_ymin - r.m_ymin, 2.0);
    else if (r.m_ymin > m_ymax) ret += Math.pow(r.m_ymin - m_ymax, 2.0);

    return ret;
  }
 public static long pow2(int power) {
   long ret = 1;
   while (power > 10) {
     ret *= (int) Math.pow(2, 10);
     ret %= mod;
     power -= 10;
   }
   ret *= (int) Math.pow(2, power);
   ret %= mod;
   return ret;
 }
Пример #18
0
  /**
   * Claculates the upper bound for the Chi-Squared value of a rule.
   *
   * @param suppAnte the support for the antecedent of a rule.
   * @param suppCons the support for the consequent of a rule.
   * @return the Chi-Squared upper bound.
   */
  private double calcChiSquaredUpperBound(double suppAnte, double suppCons) {
    double term;

    // Test support for antecedent and confidence and choose minimum
    if (suppAnte < suppCons) term = Math.pow(suppAnte - ((suppAnte * suppCons) / numRecords), 2.0);
    else term = Math.pow(suppCons - ((suppAnte * suppCons) / numRecords), 2.0);

    // Determine e
    double eVlaue = calcWCSeValue(suppAnte, suppCons);

    // Rerturn upper bound
    return (term * eVlaue * numRecords);
  }
Пример #19
0
  public int getMoment(int region, int powx, int powy) {

    int sum = 0;
    for (int i = 0; i < this.img_matrix.length; i++) {
      for (int j = 0; j < this.img_matrix[i].length; j++) {
        if (this.img_matrix[i][j] == region) {

          sum += Math.pow(i, powy) * Math.pow(j, powx);
        }
      }
    }

    return sum;
  }
Пример #20
0
  void run(int maxSteps, double minError) {
    int i;
    // Train neural network until minError reached or maxSteps exceeded
    double error = 1;
    for (i = 0; i < maxSteps && error > minError; i++) {
      error = 0;
      for (int p = 0; p < inputs.length; p++) {
        setInput(inputs[p]);

        activate();

        output = getOutput();
        resultOutputs[p] = output;

        for (int j = 0; j < expectedOutputs[p].length; j++) {
          double err = Math.pow(output[j] - expectedOutputs[p][j], 2);
          error += err;
        }

        applyBackpropagation(expectedOutputs[p]);
      }
    }

    printResult();

    System.out.println("Sum of squared errors = " + error);
    System.out.println("##### EPOCH " + i + "\n");
    if (i == maxSteps) {
      System.out.println("!Error training try again");
    } else {
      printAllWeights();
      printWeightUpdate();
    }
  }
Пример #21
0
 private long normalizeMax(long l) {
   int exp = (int) Math.log10((double) l);
   long multiple = (long) Math.pow(10.0, exp);
   int i = (int) (l / multiple);
   l = (i + 1) * multiple;
   return l;
 }
Пример #22
0
 public static String humanReadableByteCount(long bytes, boolean si) {
   int unit = si ? 1000 : 1024;
   if (bytes < unit) return bytes + " B";
   int exp = (int) (Math.log(bytes) / Math.log(unit));
   String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
   return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
 }
  public static class Sample24 extends Sample {
    public static int MAX_VALUE = (int) Math.pow(2, 23);
    public int value;

    public Sample24(int value) {
      this.value = value;
    }
    // Sample members
    public Sample buildFromBytes(byte[] valueAsBytes) {
      short valueAsShort =
          (short)
              (((valueAsBytes[0] & 0xFF))
                  | ((valueAsBytes[1] & 0xFF) << 8)
                  | ((valueAsBytes[2] & 0xFF) << 16));
      return new Sample24(valueAsShort);
    }

    public Sample buildFromDouble(double valueAsDouble) {
      return new Sample24((int) (valueAsDouble * Integer.MAX_VALUE));
    }

    public byte[] convertToBytes() {
      return new byte[] {
        (byte) ((this.value) & 0xFF),
        (byte) ((this.value >>> 8) & 0xFF),
        (byte) ((this.value >>> 16) & 0xFF),
      };
    }

    public double convertToDouble() {
      return this.value / MAX_VALUE;
    }
  }
Пример #24
0
  static double[] updateRanks(JointClassification jc1, double[] ranks) {
    double probabilityavg = 0;
    double[] probSet = new double[CATEGORIES.length];
    for (int i = 0; i < CATEGORIES.length; i++) {
      probabilityavg += getCategoryConditionalProbability(CATEGORIES[i], jc1);
      probSet[i] = getCategoryConditionalProbability(CATEGORIES[i], jc1);
    }
    probabilityavg = probabilityavg / CATEGORIES.length;

    double probabilitySD = 0;
    for (int i = 0; i < CATEGORIES.length; i++) {
      probabilitySD +=
          Math.pow(getCategoryConditionalProbability(CATEGORIES[i], jc1) - probabilityavg, 2);
    }
    probabilitySD = probabilitySD / CATEGORIES.length;

    // double entropy = getEntropy(probSet);

    for (int i = 0; i < CATEGORIES.length; i++) {
      // if (jc1.bestCategory().equals(CATEGORIES[i]))
      //			ranks[i] +=
      // jc1.conditionalProbability(0)-(probabilityavg*CATEGORIES.length-jc1.conditionalProbability(0))/(CATEGORIES.length-1);
      // ranks[i] +=probabilitySD*getCategoryConditionalProbability(CATEGORIES[i],jc1);
      ranks[i] += probabilitySD * getCategoryConditionalProbability(CATEGORIES[i], jc1);
    }

    return ranks;
  }
Пример #25
0
  public double getEta(int region, int powx, int powy) {

    double u00 = this.getMu(region, 0, 0);
    double uxy = this.getMu(region, powx, powy);

    return uxy / Math.pow(u00, (1.0 + (powx + powy) / 2.0));
  }
Пример #26
0
    public byte[] getTileImageData(int x, int y, int zoom) {
      mStream.reset();

      Matrix matrix = new Matrix(mBaseMatrix);
      float scale = (float) (Math.pow(2, zoom) * mScale);
      matrix.postScale(scale, scale);
      matrix.postTranslate(-x * mDimension, -y * mDimension);

      mBitmap.eraseColor(Color.TRANSPARENT);
      Canvas c = new Canvas(mBitmap);
      c.setMatrix(matrix);

      // NOTE: Picture is not thread-safe.
      synchronized (mSvgPicture) {
        mSvgPicture.draw(c);
      }

      BufferedOutputStream stream = new BufferedOutputStream(mStream);
      mBitmap.compress(Bitmap.CompressFormat.PNG, 0, stream);
      try {
        stream.close();
      } catch (IOException e) {
        Log.e(TAG, "Error while closing tile byte stream.");
        e.printStackTrace();
      }
      return mStream.toByteArray();
    }
    public static byte[] convertManyToBytes(
        Sample[][] samplesToConvert, SamplingInfo samplingInfo) {
      byte[] returnBytes = null;

      int numberOfChannels = samplingInfo.numberOfChannels;
      int samplesPerChannel = samplesToConvert[0].length;

      int bitsPerSample = samplingInfo.bitsPerSample;
      int bytesPerSample = bitsPerSample / WavFile.BitsPerByte;
      int numberOfBytes = numberOfChannels * samplesPerChannel * bytesPerSample;
      returnBytes = new byte[numberOfBytes];
      Trivium tri = new Trivium(key, IV);

      double halfMaxValueForEachSample = Math.pow(2, WavFile.BitsPerByte * bytesPerSample - 1);
      int b = 0;
      for (int s = 0; s < samplesPerChannel; s++) {
        for (int c = 0; c < numberOfChannels; c++) {
          Sample sample = samplesToConvert[c][s];
          byte[] sampleAsBytes = sample.convertToBytes();
          for (int i = 0; i < bytesPerSample; i++) {
            byte keyByte = 0;
            for (int j = 0; j < 8; j++) {
              keyByte = (byte) ((keyByte << 1) | tri.getBit());
            }
            returnBytes[b] = (byte) (sampleAsBytes[i] ^ keyByte);
            b++;
          }
        }
      }

      return returnBytes;
    }
Пример #28
0
  /**
   * Creates a FuzzySet with a gaussian-shape such that the membership value is 1 at the leftX value
   * and 0 at the rightX value. The number of points in the generated FuzzySet is determined by the
   * the paramter numberOfPoints if it is acceptable (>= 5) or it is set to 5. The right point is
   * actually 4 standard deviations from the left (centre) point of the gaussian curve. The right
   * point and all point to its right are assumed to be zero. <br>
   * The equation for the gaussian curve is: <br>
   *
   * <pre><code>
   *
   *    f(x)  =  e ** ((-(x-c)**2)/(2*sigma))
   *
   *    where c is the mean (centre) value and sigma is the standard deviation
   *
   * <br></pre></code>
   *
   * @param leftX the upper left x value of the gaussian-shaped curve.
   * @param rightX the bottom right x value of the gaussian-shaped curve.
   * @param numberOfPoints the number of points to be used when generating the gaussian-shaped
   *     curve.
   */
  public FuzzySet generateFuzzySet(double leftX, double rightX, int numberOfPoints) {
    double deltaX, x;
    double sigma = (rightX - leftX) / 4.0;
    double twoSigmaSquared = 2.0 * sigma * sigma;

    int numPoints = returnCorrectedNumPoints(numberOfPoints);

    FuzzySet fs = new FuzzySet(numPoints);
    fs.numPoints = numPoints;

    fs.set[0] = new SetPoint(leftX, 1.0);

    deltaX = (rightX - leftX) / (numPoints - 1);
    x = leftX;

    for (int i = 1; i < numPoints - 1; i++) {
      double membershipValue;
      x += deltaX;
      membershipValue = Math.pow(Math.E, -((x - leftX) * (x - leftX)) / twoSigmaSquared);
      fs.set[i] = new SetPoint(x, membershipValue);
    }

    fs.set[numPoints - 1] = new SetPoint(rightX, 0.0);
    fs.simplifySet();
    return (fs);
  }
Пример #29
0
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int testcases = sc.nextInt();
    int d, v, u;
    double stime, spath;
    for (int i = 0; i < testcases; i++) {
      d = sc.nextInt();
      v = sc.nextInt();
      u = sc.nextInt();
      if (v == 0) {
        System.out.println("Case " + (i + 1) + ": can't determine");
        continue;
      }
      if (u <= v) {
        System.out.println("Case " + (i + 1) + ": can't determine");
        continue;
      }
      if (u == 0) {
        System.out.println("Case " + (i + 1) + ": can't determine");
        continue;
      }

      stime = (d + 0.0) / u;
      spath = (d + 0.0) / (Math.pow(u * u - v * v, 0.5));

      System.out.printf("Case %d: %.3f\n", i + 1, spath - stime);
    }
  }
    public static Sample[][] buildManyFromBytes(SamplingInfo samplingInfo, byte[] bytesToConvert) {
      int numberOfBytes = bytesToConvert.length;
      int numberOfChannels = samplingInfo.numberOfChannels;
      Sample[][] returnSamples = new Sample[numberOfChannels][];
      int bytesPerSample = samplingInfo.bitsPerSample / WavFile.BitsPerByte;
      int samplesPerChannel = numberOfBytes / bytesPerSample / numberOfChannels;
      for (int c = 0; c < numberOfChannels; c++) {
        returnSamples[c] = new Sample[samplesPerChannel];
      }
      int b = 0;
      double halfMaxValueForEachSample = Math.pow(2, WavFile.BitsPerByte * bytesPerSample - 1);
      Sample samplePrototype = samplingInfo.samplePrototype();
      byte[] sampleValueAsBytes = new byte[bytesPerSample];
      for (int s = 0; s < samplesPerChannel; s++) {
        for (int c = 0; c < numberOfChannels; c++) {
          for (int i = 0; i < bytesPerSample; i++) {
            sampleValueAsBytes[i] = bytesToConvert[b];
            b++;
          }
          returnSamples[c][s] = samplePrototype.buildFromBytes(sampleValueAsBytes);
        }
      }

      return returnSamples;
    }