Ejemplo n.º 1
0
  /**
   * Look for ConstantDouble in ConstantPool.
   *
   * @param n Double number to look for
   * @return index on success, -1 otherwise
   */
  public int lookupDouble(double n) {
    long bits = Double.doubleToLongBits(n);

    for (int i = 1; i < index; i++) {
      if (constants[i] instanceof ConstantDouble) {
        ConstantDouble c = (ConstantDouble) constants[i];

        if (Double.doubleToLongBits(c.getBytes()) == bits) return i;
      }
    }

    return -1;
  }