@param $origDpi
@param $origW
@param $printW

@return float
169774
public static function countDpi($origDpi, $origW, $printW)
    {
        if (0 === $origDpi or 0 === $printW or 0 === $origW) {
            return 0;
        }

        return round($origDpi / ($printW / (($origW / $origDpi) * 2.54)));
    }
19997
public static double dirichletPdf(double[] pi, double a) {
        double probability=1.0;
        
        int piLength=pi.length;
        
        for(int i=0;i<piLength;++i) {
            probability*=Math.pow(pi[i], a-1);
        }
        
        double sumAi=piLength*a;
        double productGammaAi=Math.pow(gamma(a), piLength);
        probability*=gamma(sumAi)/productGammaAi;
        
        return probability;
    }
974525
private int appendInternal(DateTimePrinterParser pp) {
        Jdk8Methods.requireNonNull(pp, "pp");
        if (active.padNextWidth > 0) {
            if (pp != null) {
                pp = new PadPrinterParserDecorator(pp, active.padNextWidth, active.padNextChar);
            }
            active.padNextWidth = 0;
            active.padNextChar = 0;
        }
        active.printerParsers.add(pp);
        active.valueParserIndex = -1;
        return active.printerParsers.size() - 1;
    }
851879
private function printStepStdOut(OutputPrinter $printer, StepResult $result)
    {
        if (!$result instanceof ExecutedStepResult || null === $result->getCallResult()->getStdOut()) {
            return;
        }

        $callResult = $result->getCallResult();
        $indentedText = $this->subIndentText;

        $pad = function ($line) use ($indentedText) {
            return sprintf(
                '%s│ {+stdout}%s{-stdout}', $indentedText, $line
            );
        };

        $printer->writeln(implode("\n", array_map($pad, explode("\n", $callResult->getStdOut()))));
    }
1090105
public static int dp2px(Context context, float dpVal) {
        return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
                dpVal, context.getResources().getDisplayMetrics());
    }
1195273
def pprint(self, ind):
        """"""
        pp = pprint.PrettyPrinter(indent=ind)
        pp.pprint(self.tree)
217137
final public void print(int i)
  {
    Writer out = this.out;
    if (out == null)
      return;
    
    if (i == 0x80000000) {
      print("-2147483648");
      return;
    }

    try {
      if (i < 0) {
        out.write('-');
        i = -i;
      } else if (i < 9) {
        out.write('0' + i);
        return;
      }

      int length = 0;
      int exp = 10;

      if (i >= 1000000000)
        length = 9;
      else {
        for (; i >= exp; length++)
          exp = 10 * exp;
      }

      int j = 31;
    
      while (i > 0) {
        _tempCharBuffer[--j] = (char) ((i % 10) + '0');
        i /= 10;
      }

      out.write(_tempCharBuffer, j, 31 - j);
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
1167528
def p_exprgt(p):
    
    a = int(p[1]) if p[1].isdigit() else 0
    b = int(p[3]) if p[3].isdigit() else 0

    p[0] = '1' if a > b else '0'
757276
def do(self, x_orig):
        
        if self.scales is None:
            return x_orig
        else:
            return np.dot(self.rotation.transpose(), x_orig)*self.scales
271774
public static Object copy(Object orig)
	{
		Object obj = null;
		try
		{
			// Write the object out to a byte array
			FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
			ObjectOutputStream out = new ObjectOutputStream(fbos);
			out.writeObject(orig);
			out.flush();
			out.close();

			// Retrieve an input stream from the byte array and read
			// a copy of the object back in.
			ObjectInputStream in = new ObjectInputStream(fbos.getInputStream());
			obj = in.readObject();
		} catch (IOException e)
		{
			e.printStackTrace();
		} catch (ClassNotFoundException cnfe)
		{
			cnfe.printStackTrace();
		}
		return obj;
	}
345691
private void HelperRGB(float red, float green, float blue) {
    	PdfXConformanceImp.checkPDFXConformance(writer, PdfXConformanceImp.PDFXKEY_RGB, null);
        if (red < 0)
            red = 0.0f;
        else if (red > 1.0f)
            red = 1.0f;
        if (green < 0)
            green = 0.0f;
        else if (green > 1.0f)
            green = 1.0f;
        if (blue < 0)
            blue = 0.0f;
        else if (blue > 1.0f)
            blue = 1.0f;
        content.append(red).append(' ').append(green).append(' ').append(blue);
    }
1355342
@Override
	public void setTo( Planar<T> orig) {
		if (orig.width != width || orig.height != height)
			reshape(orig.width,orig.height);
		if( orig.getBandType() != getBandType() )
			throw new IllegalArgumentException("The band type must be the same");

		int N = orig.getNumBands();
		if( N != getNumBands() ) {
			setNumberOfBands(orig.getNumBands());
		}

		for( int i = 0; i < N; i++ ) {
			bands[i].setTo(orig.getBand(i));
		}
	}
738421
def get_scaled_cutout_wdhtdp_view(shp, p1, p2, new_dims):
    
    x1, y1, z1 = p1
    x2, y2, z2 = p2
    new_wd, new_ht, new_dp = new_dims

    x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2), int(z1), int(z2)
    z1, z2, new_wd, new_ht = int(z1), int(z2), int(new_wd), int(new_ht)

    # calculate dimensions of NON-scaled cutout
    old_wd = x2 - x1 + 1
    old_ht = y2 - y1 + 1
    old_dp = z2 - z1 + 1
    max_x, max_y, max_z = shp[1] - 1, shp[0] - 1, shp[2] - 1

    if (new_wd != old_wd) or (new_ht != old_ht) or (new_dp != old_dp):
        # Make indexes and scale them
        # Is there a more efficient way to do this?
        yi = np.mgrid[0:new_ht].reshape(-1, 1, 1)
        xi = np.mgrid[0:new_wd].reshape(1, -1, 1)
        zi = np.mgrid[0:new_dp].reshape(1, 1, -1)
        iscale_x = float(old_wd) / float(new_wd)
        iscale_y = float(old_ht) / float(new_ht)
        iscale_z = float(old_dp) / float(new_dp)

        xi = (x1 + xi * iscale_x).clip(0, max_x).astype(np.int, copy=False)
        yi = (y1 + yi * iscale_y).clip(0, max_y).astype(np.int, copy=False)
        zi = (z1 + zi * iscale_z).clip(0, max_z).astype(np.int, copy=False)
        wd, ht, dp = xi.shape[1], yi.shape[0], zi.shape[2]

        # bounds check against shape (to protect future data access)
        xi_max, yi_max, zi_max = xi[0, -1, 0], yi[-1, 0, 0], zi[0, 0, -1]
        assert xi_max <= max_x, ValueError("X index (%d) exceeds shape bounds (%d)" % (xi_max, max_x))
        assert yi_max <= max_y, ValueError("Y index (%d) exceeds shape bounds (%d)" % (yi_max, max_y))
        assert zi_max <= max_z, ValueError("Z index (%d) exceeds shape bounds (%d)" % (zi_max, max_z))

        view = np.s_[yi, xi, zi]

    else:
        # simple stepped view will do, because new view is same as old
        wd, ht, dp = old_wd, old_ht, old_dp
        view = np.s_[y1:y2 + 1, x1:x2 + 1, z1:z2 + 1]

    # Calculate actual scale used (vs. desired)
    old_wd, old_ht, old_dp = max(old_wd, 1), max(old_ht, 1), max(old_dp, 1)
    scale_x = float(wd) / old_wd
    scale_y = float(ht) / old_ht
    scale_z = float(dp) / old_dp

    # return view + actual scale factors used
    return (view, (scale_x, scale_y, scale_z))
145129
public void print(int i)
  {
    if (i == 0x80000000) {
      print("-2147483648");
      return;
    }

    if (i < 0) {
      write('-');
      i = -i;
    } else if (i < 9) {
      write('0' + i);
      return;
    }

    int length = 0;
    int exp = 10;

    if (i >= 1000000000)
      length = 9;
    else {
      for (; i >= exp; length++)
        exp = 10 * exp;
    }

    int j = 31;
    
    while (i > 0) {
      _tempCharBuffer[--j] = (char) ((i % 10) + '0');
      i /= 10;
    }

    write(_tempCharBuffer, j, 31 - j);
  }
1334802
private static String[] copyOf(String[] orig, int size) {
        final String[] copy = new String[size];
        System.arraycopy(orig, 0, copy, 0,
                Math.min(orig.length, size));
        return copy;
    }
69828
public static void process(GrayU8 orig,
							   GrayS16 derivX,
							   GrayS16 derivY) {
		final byte[] data = orig.data;
		final short[] imgX = derivX.data;
		final short[] imgY = derivY.data;

		final int width = orig.getWidth();
		final int height = orig.getHeight() - 1;

		//CONCURRENT_BELOW BoofConcurrency.loopFor(1,height,y->{
		for (int y = 1; y < height; y++) {
			int endX = width * y + width - 1;

			for (int index = width * y + 1; index < endX; index++) {
				int v = (data[index + width + 1] & 0xFF) - (data[index - width - 1] & 0xFF);
				int w = (data[index + width - 1] & 0xFF) - (data[index - width + 1] & 0xFF);

				imgY[index] = (short) (((data[index + width] & 0xFF) - (data[index - width] & 0xFF)) * 2 + v + w);

				imgX[index] = (short) (((data[index + 1] & 0xFF) - (data[index - 1] & 0xFF)) * 2 + v - w);
			}
		}
		//CONCURRENT_ABOVE });
	}
439877
public static void derivX_F32(GrayF32 orig,
								  GrayF32 derivX) {
		final float[] data = orig.data;
		final float[] imgX = derivX.data;

		final int width = orig.getWidth();
		final int height = orig.getHeight();

		for (int y = 0; y < height; y++) {
			int index = width * y + 1;
			int endX = index + width - 2;
			int endXAlt = endX - (width - 2) % 3;

			float x0 = data[index - 1];
			float x1 = data[index];

			for (; index < endXAlt;) {
				float x2 = data[index + 1];
				imgX[index++] = (x2 - x0) * 0.5f;
				x0 = data[index + 1];
				imgX[index++] = (x0 - x1) * 0.5f;
				x1 = data[index + 1];
				imgX[index++] = (x1 - x2) * 0.5f;
			}

			for (; index < endX; index++) {
				imgX[index] = (data[index + 1] - data[index - 1]) * 0.5f;
			}
		}
	}