public double evaluate(Vector x) { double sum = 0.0; for (int i = 0; i < getDimension(); ++i) { sum += Math.floor(x.getReal(i) + 0.5) * Math.floor(x.getReal(i) + 0.5); } return sum; }

public static void main(String[] ARGS) { double latitude = 0; double longitude = 0; if (ARGS.length < 2) { System.out.println("Usage: GridConverter <latitude> <longitude>"); System.exit(1); } try { latitude = Double.parseDouble(ARGS[0]); longitude = Double.parseDouble(ARGS[1]); } catch (NumberFormatException nfe) { System.err.println("Please check your number formats."); System.exit(1); } latitude = 41.7146; longitude = -72.7271; System.out.println(" Converting " + longitude + ", " + latitude); double olong = 180.0 + longitude; double olat = 90.0 + latitude; System.out.println(olong + " " + olat); int fieldLongitude = (int) (Math.floor(olong / 20.0)); int fieldLatitude = (int) (Math.floor(olat / 10.0)); System.out.println(fieldLongitude + " " + fieldLatitude); char field1 = field[fieldLongitude]; char field2 = field[fieldLatitude]; double degreesFromEasting = olong - (fieldLongitude * 20); double degreesFromNorthing = olat - (fieldLatitude * 10); System.out.println(degreesFromEasting + " " + degreesFromNorthing); int squareLongitude = (int) Math.floor(degreesFromEasting / 2); int squareLatitude = (int) Math.floor(degreesFromNorthing); System.out.println(field1 + "" + field2 + "" + squareLongitude + "" + squareLatitude); }

public static String getReadableTime(double value, Unit unit) { if (unit.equals(Unit.PEOPLE)) return " " + (int) value + " people"; double minutes = 0; double hours = 0; double seconds = 0; if (value < 0d) return ""; else { if (value / 60 > 1d) // check if minutes need to be displayed { if (value / 3600 > 1d) // check if hours need to be displayed { hours = Math.floor(value / 3600); minutes = Math.floor((value - hours * 3600) / 60); seconds = Math.floor((value - (hours * 3600) - (minutes * 60))); return " > " + (int) hours + "h, " + (int) minutes + "m, " + (int) seconds + "s"; } else { minutes = Math.floor(value / 60); seconds = Math.floor((value - (minutes * 60))); return " > " + (int) minutes + "m, " + (int) seconds + "s"; } } else { return " > " + (int) seconds + "s"; } } }

/** * 计算初始采样率 * * @param options * @param minSideLength * @param maxNumOfPixels * @return */ private static int computeInitialSampleSize( BitmapFactory.Options options, int minSideLength, int maxNumOfPixels) { double w = options.outWidth; double h = options.outHeight; int lowerBound = (maxNumOfPixels == -1) ? 1 : (int) Math.ceil(Math.sqrt(w * h / maxNumOfPixels)); int upperBound = (minSideLength == -1) ? 128 : (int) Math.min(Math.floor(w / minSideLength), Math.floor(h / minSideLength)); if (upperBound < lowerBound) { // return the larger one when there is no overlapping zone. return lowerBound; } if ((maxNumOfPixels == -1) && (minSideLength == -1)) { return 1; } else if (minSideLength == -1) { return lowerBound; } else { return upperBound; } }

public Rectangle getBounds() { int x1 = (int) Math.floor(getMinX()); int y1 = (int) Math.floor(getMinY()); int x2 = (int) Math.ceil(getMaxX()); int y2 = (int) Math.ceil(getMaxY()); return new Rectangle(x1, y1, x2 - x1, y2 - y1); }

static void calculateInSampleSize( int paramInt1, int paramInt2, int paramInt3, int paramInt4, BitmapFactory.Options paramOptions, Request paramRequest) { int i = 1; if ((paramInt4 > paramInt2) || (paramInt3 > paramInt1)) { if (paramInt2 != 0) { break label43; } } for (i = (int) Math.floor(paramInt3 / paramInt1); ; i = (int) Math.floor(paramInt4 / paramInt2)) { paramOptions.inSampleSize = i; paramOptions.inJustDecodeBounds = false; return; label43: if (paramInt1 != 0) { break; } } paramInt2 = (int) Math.floor(paramInt4 / paramInt2); paramInt1 = (int) Math.floor(paramInt3 / paramInt1); if (paramRequest.centerInside) {} for (i = Math.max(paramInt2, paramInt1); ; i = Math.min(paramInt2, paramInt1)) { break; } }

/** * Converts an double (multiplied by 100 and cast to an int) into an array of bytes. * * @param i the int * @return a byte array */ private static byte[] convertToBytes(int i) { int size = (int) Math.floor(Math.log(i) / Math.log(10)); if (i % 100 != 0) { size += 2; } if (i % 10 != 0) { size++; } if (i < 100) { size++; if (i < 10) { size++; } } size--; byte[] cache = new byte[size]; size--; if (i < 100) { cache[0] = (byte) '0'; } if (i % 10 != 0) { cache[size--] = bytes[i % 10]; } if (i % 100 != 0) { cache[size--] = bytes[(i / 10) % 10]; cache[size--] = (byte) '.'; } size = (int) Math.floor(Math.log(i) / Math.log(10)) - 1; int add = 0; while (add < size) { cache[add] = bytes[(i / (int) Math.pow(10, size - add + 1)) % 10]; add++; } return cache; }

@Override public boolean applyEffectEntity( ItemStack stack, World world, EntityLivingBase caster, Entity target) { if (target instanceof EntityLivingBase) { int duration = SpellUtils.instance.getModifiedInt_Mul( BuffList.default_buff_duration, stack, caster, target, world, 0, SpellModifiers.DURATION); duration = SpellUtils.instance.modifyDurationBasedOnArmor(caster, duration); int x = (int) Math.floor(target.posX); int y = (int) Math.floor(target.posY); int z = (int) Math.floor(target.posZ); if (RitualShapeHelper.instance.checkForRitual(this, world, x, y, z) != null) { duration += (3600 * (SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0) + 1)); RitualShapeHelper.instance.consumeRitualReagents(this, world, x, y, z); } if (!world.isRemote) ((EntityLivingBase) target) .addPotionEffect( new BuffEffectTrueSight( duration, SpellUtils.instance.countModifiers(SpellModifiers.BUFF_POWER, stack, 0))); return true; } return false; }

public void acomoda() { int i = 1; int numAleatorio = (int) Math.floor(Math.random() * (15 - 1 + 1) + 1); cartas[0] = numAleatorio; while (i < 30) { numAleatorio = (int) Math.floor(Math.random() * (15 - 1 + 1) + 1); int rep = 0; for (int h = 0; h < i; h++) { if (numAleatorio == cartas[h]) { rep++; } } if (rep < 2) { cartas[i] = numAleatorio; i++; } } for (int a = 0; a < 30; a++) { listas[a] = false; } }

private int[] makeCircle(int D) { double ray = ((double) D) / 2; double xCenter = ((double) N) / 2; double yCenter = ((double) M) / 2; MinMax[] lines = new MinMax[M]; TreeSet<Point> points = new TreeSet<Point>(); for (int i = 0; i < 100; i++) { double angle = Math.PI * ((double) i) / 100.0; int x = (int) Math.floor(xCenter + (ray * Math.cos(angle))); int y = (int) Math.floor(yCenter + (ray * Math.sin(angle))); if (x < 0) x = 0; if (x >= N) x = N - 1; if (y < 0) y = 0; if (y >= M) y = M - 1; Point p = new Point(x, y); points.add(p); MinMax line = lines[y]; if (line == null) { lines[y] = new MinMax(); } lines[y].add(x); ; } int stones = points.size(); int enclosed = 0; for (int i = 0; i < lines.length; i++) { MinMax mm = lines[i]; if (mm != null) { enclosed += mm.size(); } } return new int[] {stones, enclosed}; }

/* * Random Number Generator for SignRank * */ public static double rsignrank(Session context, double n) { int i, k; double r; /* NaNs propagated correctly */ if (Double.isNaN(n)) { return (n); } n = Math.floor(n + 0.5); if (n < 0) { return Double.NaN; } if (n == 0) { return (0); } r = 0.0; k = (int) n; for (i = 0; i < k; ) { r += (++i) * Math.floor(context.rng.unif_rand() + 0.5); } return (r); }

public static double dsignrank(double x, double n, boolean give_log) { double d; /* NaNs propagated correctly */ if (Double.isNaN(x) || Double.isNaN(n)) { return (x + n); } n = Math.floor(n + 0.5); if (n <= 0) { return Double.NaN; } if (Math.abs(x - Math.floor(x + 0.5)) > 1e-7) { return (R_D__0(true, give_log)); } x = Math.floor(x + 0.5); if ((x < 0) || (x > (n * (n + 1) / 2))) { return (R_D__0(true, give_log)); } w_init_maybe((int) n); d = R_D_exp(Math.log(csignrank((int) x, (int) n)) - n * Math.log(2.), true, give_log); return (d); }

/** * DOCUMENT ME! * * @param message DOCUMENT ME! * @param password DOCUMENT ME! * @return DOCUMENT ME! */ public static String scramble(String message, String password) { long[] hashPass; long[] hashMessage; byte[] to = new byte[8]; String val = ""; // $NON-NLS-1$ message = message.substring(0, 8); if ((password != null) && (password.length() > 0)) { hashPass = newHash(password); hashMessage = newHash(message); RandStructcture randStruct = randomInit(hashPass[0] ^ hashMessage[0], hashPass[1] ^ hashMessage[1]); int msgPos = 0; int msgLength = message.length(); int toPos = 0; while (msgPos++ < msgLength) { to[toPos++] = (byte) (Math.floor(rnd(randStruct) * 31) + 64); } /* Make it harder to break */ byte extra = (byte) (Math.floor(rnd(randStruct) * 31)); for (int i = 0; i < to.length; i++) { to[i] ^= extra; } val = new String(to); } return val; }

@Override public void recordstate(double time, boolean exportflows, int outsteps) throws SiriusException { success = false; double min = Math.floor(time / 60); double hrs = Math.floor(min / 60); ts.set(Calendar.HOUR_OF_DAY, (int) hrs); ts.set(Calendar.MINUTE, (int) (min - hrs * 60)); ts.set(Calendar.SECOND, (int) (time - min * 60)); OutputParameters params = new OutputParameters( exportflows, 0 == scenario.clock.getCurrentstep() ? 1 : outsteps, scenario.getSimDtInSeconds() * outsteps); for (com.relteq.sirius.jaxb.Network network : scenario.getNetworkList().getNetwork()) { for (com.relteq.sirius.jaxb.Link link : network.getLinkList().getLink()) { Link _link = (Link) link; try { LinkDataTotal db_ldt = fill_total(_link, params); fill_detailed(_link, params, db_ldt.getSpeed()); } catch (Exception exc) { throw new SiriusException(exc); } finally { _link.reset_cumulative(); } } } success = true; }

public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { DimensionalLinkEntry[] entries = readEntries(itemStack); if (player.isSneaking()) { if (!world.isRemote) { int dimID = world.provider.dimensionId; DimensionalLinkEntry alreadyHasForThisWorld = null; for (DimensionalLinkEntry entry : entries) if (entry.dimID == dimID) alreadyHasForThisWorld = entry; if (alreadyHasForThisWorld != null) removeEntry(itemStack, alreadyHasForThisWorld.dimID); addEntry( itemStack, new DimensionalLinkEntry( dimID, (int) Math.floor(player.posX), (int) Math.floor(player.posY), (int) Math.floor(player.posZ))); player.addChatMessage(EnumChatFormatting.DARK_GREEN + "Warp point for this world set."); } } else { int dimID = world.provider.dimensionId; DimensionalLinkEntry link = null; for (DimensionalLinkEntry entry : entries) if (entry.dimID == dimID) link = entry; if (link != null) { double targetX = link.x + 0.5D; double targetY = link.y + 1.0D; double targetZ = link.z + 0.5D; EAVector3 targetVec = new EAVector3(targetX, targetY, targetZ); EAVector3 playerVec = EAVector3.fromEntityCenter(player); double distance = targetVec.subtract(playerVec).mag(); int rfToConsume = (int) (distance * 2500.0D); if ((getEnergyStored(itemStack) >= rfToConsume) || ((player.capabilities.isCreativeMode) && (ensureCooldown(itemStack)))) { for (int i = 0; i < 128; i++) { world.spawnParticle( "portal", targetX, targetY, targetZ, world.rand.nextGaussian(), 0.0D, world.rand.nextGaussian()); } if (!world.isRemote) { if (!player.capabilities.isCreativeMode) extractEnergy(itemStack, rfToConsume, false); player.setPositionAndUpdate(targetX, targetY, targetZ); player.addChatMessage(EnumChatFormatting.DARK_GREEN + "Teleported."); } } else { player.addChatMessage(EnumChatFormatting.DARK_RED + "Not enough energy."); } } else { player.addChatMessage( EnumChatFormatting.DARK_RED + "Warp point is not set for this world."); } } return itemStack; }

/** * Writes the JSON file that has the stock dates and values for each respective filename. * * @param filename a json file that represents the current stock calculation */ public void writeJSON(String filename) throws IOException { // Add json writing code here PrintWriter pw = new PrintWriter(filename); double round = 0; pw.print("{\n\t\"labels\": ["); // Prints the dates for (int i = 0; i < dates.size(); i++) { if (i == dates.size() - 1) { pw.print("\"" + dates.get(i) + "\""); } else { pw.print("\"" + dates.get(i) + "\","); } } pw.print("],\n\t\"datasets\": [\n\t\t{\n\t\t\t\"data\": ["); // Prints the values for (int i = 0; i < values.size(); i++) { if (i == values.size() - 1) { round = Math.floor(values.get(i) * 100) / 100; pw.print(round); } else { round = Math.floor(values.get(i) * 100) / 100; pw.printf(round + ","); } } pw.print("]\n\t\t}\n\t]\n}"); pw.close(); return; }

private static int computeInitialSampleSize( BitmapFactory.Options options, int reqWidth, int reqHeight) { // Raw height and width of image final double height = options.outHeight; final double width = options.outWidth; final long maxNumOfPixels = reqWidth * reqHeight; final int minSideLength = Math.min(reqHeight, reqWidth); int lowerBound = (maxNumOfPixels < 0) ? 1 : (int) Math.ceil(Math.sqrt(width * height / maxNumOfPixels)); int upperBound = (minSideLength < 0) ? 128 : (int) Math.min(Math.floor(width / minSideLength), Math.floor(height / minSideLength)); if (upperBound < lowerBound) { // return the larger one when there is no overlapping zone. return lowerBound; } if (maxNumOfPixels < 0 && minSideLength < 0) { return 1; } else if (minSideLength < 0) { return lowerBound; } else { return upperBound; } }

private Dataset getImage(int[] box, FilterType type) throws Exception { if (box[0] % 2 == 0) throw new Exception("Box first dim is not odd!"); if (box[1] % 2 == 0) throw new Exception("Box second dim is not odd!"); // Compute some things to save FPOs int n = box[0] * box[1]; // Save a FPO inside loop. final double[] filter = new double[shape[0] * shape[1]]; int r1 = (int) Math.floor(box[0] / 2d); // for instance 3->1, 5->2, 7->3 int r2 = (int) Math.floor(box[1] / 2d); // for instance 3->1, 5->2, 7->3 int[] radii = new int[] {r1, r2}; if (sum2 == null) createSummedTable(image, true); int[] point = new int[] {0, 0}; int[] coords = new int[] {0, 0, 0, 0}; for (int i = 0; i < filter.length; i++) { // Point from the iterator fillNDPositionFromShape(i, shape, point); // Save FPO by calculating coords once per pixel and // passing to getBoxVarianceInternal and getBoxMeanInternal fillCoordsInternal(point, shape, radii, coords); // Call fano (variance/mean) if (type == FilterType.MEAN) filter[i] = getBoxFanoFactorInternal(coords, n); else if (type == FilterType.FANO) filter[i] = getBoxMeanInternal(coords, n); } return new DoubleDataset(filter, shape); }

public static final float snoise(float x, float y, float z) { int xf = (int) Math.floor(x); int yf = (int) Math.floor(y); int zf = (int) Math.floor(z); int X = xf & 255; int Y = yf & 255; int Z = zf & 255; x -= xf; y -= yf; z -= zf; float u = fade(x); float v = fade(y); float w = fade(z); int A = p[X] + Y, AA = p[A] + Z, AB = p[A + 1] + Z, B = p[X + 1] + Y, BA = p[B] + Z, BB = p[B + 1] + Z; return lerp( w, lerp( v, lerp(u, grad(p[AA], x, y, z), grad(p[BA], x - 1, y, z)), lerp(u, grad(p[AB], x, y - 1, z), grad(p[BB], x - 1, y - 1, z))), lerp( v, lerp(u, grad(p[AA + 1], x, y, z - 1), grad(p[BA + 1], x - 1, y, z - 1)), lerp(u, grad(p[AB + 1], x, y - 1, z - 1), grad(p[BB + 1], x - 1, y - 1, z - 1)))); }

private String getPercentsTailHelper(BigDecimal percents) { return ((percents.doubleValue() - Math.floor(percents.doubleValue())) > 0) ? " целых " + Math.round((percents.doubleValue() - Math.floor(percents.doubleValue())) * 100) + " сотых" : ""; }

/** * Draw the LineSelection at its current location. It is the responsibility of the * applet/application to draw the LineSelection at the appropriate times, e.g., inside the * component's update() and/or paint() method. This gives maximum flexibility for double * buffering, etc. * * @param g The Graphics context to use for drawing. */ public void draw(Graphics g) { if (!isVisible()) { return; } Color saveColor = g.getColor(); g.setColor(color); if (thickness > 1) { double ratio = ((double) thickness) / ((double) length()); double txdb = ratio * ((double) height) / 2.0; int tx = txdb > 0 ? ((int) Math.ceil(txdb)) : ((int) Math.floor(txdb)); double tydb = -ratio * ((double) width) / 2.0; int ty = tydb > 0 ? ((int) Math.ceil(tydb)) : ((int) Math.floor(tydb)); Point[] poly = new Point[4]; for (int i = 0; i < 4; i++) poly[i] = new Point(x, y); poly[0].translate(tx, ty); poly[1].translate(-tx, -ty); poly[2].translate(width, height); poly[2].translate(-tx, -ty); poly[3].translate(width, height); poly[3].translate(tx, ty); Polygon polygon = new Polygon(); for (int i = 0; i < 4; i++) polygon.addPoint(poly[i].x, poly[i].y); g.fillPolygon(polygon); } else g.drawLine(x, y, x + width, y + height); g.setColor(saveColor); } // end draw

/** * Get the linear day in days since the epoch, using the Julian or Gregorian calendar as * specified. If you specify a nonpositive year it is interpreted as BC as following: 0 is 1 BC, * -1 is 2 BC and so on. * * @param year the year of the date. * @param dayOfYear the day of year of the date; 1 based. * @param gregorian <code>true</code>, if we should use the Gregorian rules. * @return the days since the epoch, may be negative. */ private long getLinearDay(int year, int dayOfYear, boolean gregorian) { // The 13 is the number of days, that were omitted in the Gregorian // Calender until the epoch. // We shift right by 2 instead of dividing by 4, to get correct // results for negative years (and this is even more efficient). long julianDay = (year - 1) * 365L + ((year - 1) >> 2) + (dayOfYear - 1) - EPOCH_DAYS; // gregorian days from 1 to epoch. if (gregorian) { // subtract the days that are missing in gregorian calendar // with respect to julian calendar. // // Okay, here we rely on the fact that the gregorian // calendar was introduced in the AD era. This doesn't work // with negative years. // // The additional leap year factor accounts for the fact that // a leap day is not seen on Jan 1 of the leap year. int gregOffset = (int) Math.floor((double) (year - 1) / 400.) - (int) Math.floor((double) (year - 1) / 100.); return julianDay + gregOffset; } else julianDay -= 2; return julianDay; }

IntLocation(MyLocation loc) { this( (int) Math.floor(loc.getX()), (int) Math.floor(loc.getY()), (int) Math.floor(loc.getZ()), loc.getBukkitLocation().getWorld().getName()); }

public Grid(float width, float height) { xSteps = (int) Math.floor(width / cellSize); ySteps = (int) Math.floor(height / cellSize); this.width = xSteps * cellSize; this.height = ySteps * cellSize; System.out.println( "Creating new Grid, xStep: " + xSteps + " yStep: " + ySteps + " cellSize: " + cellSize + " Intended width/height: " + width + "/" + height + " Actual: " + xSteps * cellSize + "/" + ySteps * cellSize); cells = new Cell[xSteps][ySteps]; for (int x = 0; x < xSteps; x += 1) { for (int y = 0; y < ySteps; y += 1) { cells[x][y] = new Cell(x * cellSize, y * cellSize, cellSize, cellSize); } } }

private void fetchCollidableRects() { int p1x = (int) bounds.x; int p1y = (int) Math.floor(bounds.y); int p2x = (int) (bounds.x + bounds.width); int p2y = (int) Math.floor(bounds.y); int p3x = (int) (bounds.x + bounds.width); int p3y = (int) (bounds.y + bounds.height); int p4x = (int) bounds.x; int p4y = (int) (bounds.y + bounds.height); int[][] tiles = map.tiles; int tile1 = tiles[p1x][map.tiles[0].length - 1 - p1y]; int tile2 = tiles[p2x][map.tiles[0].length - 1 - p2y]; int tile3 = tiles[p3x][map.tiles[0].length - 1 - p3y]; int tile4 = tiles[p4x][map.tiles[0].length - 1 - p4y]; if (tile1 != Map.EMPTY) r[0].set(p1x, p1y, 1, 1); else r[0].set(-1, -1, 0, 0); if (tile2 != Map.EMPTY) r[1].set(p2x, p2y, 1, 1); else r[1].set(-1, -1, 0, 0); if (tile3 != Map.EMPTY) r[2].set(p3x, p3y, 1, 1); else r[2].set(-1, -1, 0, 0); if (tile4 != Map.EMPTY) r[3].set(p4x, p4y, 1, 1); else r[3].set(-1, -1, 0, 0); }

public float getHeightOfTerrain(float worldX, float worldZ) { float terrainX = worldX - this.x; float terrainZ = worldZ - this.z; float gridSquareSize = SIZE / ((float) heights.length - 1); int gridX = (int) Math.floor(terrainX / gridSquareSize); int gridZ = (int) Math.floor(terrainZ / gridSquareSize); if (gridX >= heights.length - 1 || gridZ >= heights.length - 1 || gridX < 0 || gridZ < 0) { return 0; } float xCoord = (terrainX % gridSquareSize) / gridSquareSize; float zCoord = (terrainZ % gridSquareSize) / gridSquareSize; float answer; if (xCoord <= (1 - zCoord)) { answer = Maths.barryCentric( new Vector3f(0, heights[gridX][gridZ], 0), new Vector3f(1, heights[gridX + 1][gridZ], 0), new Vector3f(0, heights[gridX][gridZ + 1], 1), new Vector2f(xCoord, zCoord)); } else { answer = Maths.barryCentric( new Vector3f(1, heights[gridX + 1][gridZ], 0), new Vector3f(1, heights[gridX + 1][gridZ + 1], 1), new Vector3f(0, heights[gridX][gridZ + 1], 1), new Vector2f(xCoord, zCoord)); } return answer; }

public static void main(String[] args) { try { double arg1 = Double.parseDouble(args[0]); double arg2 = Double.parseDouble(args[1]); double arg3 = Double.parseDouble(args[2]); if ((Math.floor(arg1) == arg1 && Math.floor(arg2) == arg2 && Math.floor(arg3) == arg3)) { if (arg1 <= 2000000000 && arg2 <= 2000000000 && arg3 <= 2000000000) { // check to see that double is not overflowed Triangle_Bug4 tr = new Triangle_Bug4(arg1, arg2, arg3); System.out.println(tr.findTriangleType()); } else { System.out.println("Error: All three inputs must be less than or equal to 2147483647."); } } else { System.out.println("Error: All three inputs must be integers."); } } catch (Exception e) { System.out.println("Error: Bad Input"); } }

// TODO: Add condition check public boolean checkEntity(Entity entity) { for (SegmentEntity segment : segmentsEntities) { if (segment.getCheckClass().isAssignableFrom(entity.getClass())) { if (segment.getType() == EntityType.TRACKED) { if (segment.checkCondition(entity)) { int range = segment.getRange(entity); Resident owner = segment.getOwner(entity); int dim = entity.dimension; int x = (int) Math.floor(entity.posX); int y = (int) Math.floor(entity.posY); int z = (int) Math.floor(entity.posZ); if (range == 0) { if (!hasPermission(owner, segment, dim, x, y, z)) { return true; } } else { Volume rangeBox = new Volume(x - range, y - range, z - range, x + range, y + range, z + range); if (!hasPermission(owner, segment, dim, rangeBox)) { return true; } } } } } } return false; }

public static int stepSize(int recordNumber, double multiplier) { int[] bumps = {1, 2, 5}; double log = Math.floor(multiplier * Math.log10(recordNumber)); int bump = bumps[(int) log % bumps.length]; int scale = (int) Math.pow(10, Math.floor(log / bumps.length)); return bump * scale; }

private static int getidx(int subdiv, float x, float y) { int ix = (int) Math.floor(subdiv * x), iy = (int) Math.floor(subdiv * y); ix = Math.max(Math.min(ix, subdiv - 1), 0); iy = Math.max(Math.min(iy, subdiv - 1), 0); return ix * subdiv + iy; }