List of usage examples for java.lang Integer MAX_VALUE
int MAX_VALUE
To view the source code for java.lang Integer MAX_VALUE.
Click Source Link
From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.FloatDataConverter.java
@Override public String valueToString(Float value) { if (value == null) return ""; DecimalFormat df = (DecimalFormat) NumberFormat.getNumberInstance(LocaleContextHolder.getLocale()); df.setGroupingUsed(false);//from ww w. j a v a 2 s . co m df.setMaximumFractionDigits(Integer.MAX_VALUE); return df.format(value); }
From source file:io.marto.aem.utils.freemarker.FreemarkerTemplateFactory.java
/** * Create an instance that loads templates from an OSGi <tt>bundle</tt>. * * @param bundle the OSGi bundle used to load all templates from *//*from w ww . j a v a 2 s. c o m*/ public FreemarkerTemplateFactory(final Bundle bundle) { this.config = new Configuration(); config.setObjectWrapper(new DefaultObjectWrapper()); config.setTemplateUpdateDelay(Integer.MAX_VALUE); config.setLocalizedLookup(false); config.setTemplateLoader(new URLTemplateLoader() { @Override protected URL getURL(String url) { return bundle.getEntry(url); } }); }
From source file:com.joconner.g11n.charprop.service.BlocksServiceTest.java
@Test public void testNoBlockForUndefinedChars() { Block noBlock = service.getNoBlock(); int[] ch = { Integer.MIN_VALUE, -1, 0x10fff, 0x104B0, 0x2CEB0, 0x110000, Integer.MAX_VALUE }; for (int c : ch) { Block b = service.getBlockFor(c); assertEquals(noBlock, b);//from w ww. j av a 2 s. c o m } }
From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.DoubleDataConverter.java
@Override public String valueToString(Double value) { if (value == null) return ""; DecimalFormat df = (DecimalFormat) NumberFormat.getNumberInstance(LocaleContextHolder.getLocale()); df.setGroupingUsed(false);//w w w . j a va 2 s. com df.setMaximumFractionDigits(Integer.MAX_VALUE); return df.format(value); }
From source file:Main.java
/** * <p>Compares all Strings in an array and returns the index at which the * Strings begin to differ.</p>// w w w .j a v a 2 s . c o m * * <p>For example, * <code>indexOfDifference(new String[] {"i am a machine", "i am a robot"}) -> 7</code></p> * * <pre> * StringUtils.indexOfDifference(null) = -1 * StringUtils.indexOfDifference(new String[] {}) = -1 * StringUtils.indexOfDifference(new String[] {"abc"}) = -1 * StringUtils.indexOfDifference(new String[] {null, null}) = -1 * StringUtils.indexOfDifference(new String[] {"", ""}) = -1 * StringUtils.indexOfDifference(new String[] {"", null}) = 0 * StringUtils.indexOfDifference(new String[] {"abc", null, null}) = 0 * StringUtils.indexOfDifference(new String[] {null, null, "abc"}) = 0 * StringUtils.indexOfDifference(new String[] {"", "abc"}) = 0 * StringUtils.indexOfDifference(new String[] {"abc", ""}) = 0 * StringUtils.indexOfDifference(new String[] {"abc", "abc"}) = -1 * StringUtils.indexOfDifference(new String[] {"abc", "a"}) = 1 * StringUtils.indexOfDifference(new String[] {"ab", "abxyz"}) = 2 * StringUtils.indexOfDifference(new String[] {"abcde", "abxyz"}) = 2 * StringUtils.indexOfDifference(new String[] {"abcde", "xyz"}) = 0 * StringUtils.indexOfDifference(new String[] {"xyz", "abcde"}) = 0 * StringUtils.indexOfDifference(new String[] {"i am a machine", "i am a robot"}) = 7 * </pre> * * @param strs array of strings, entries may be null * @return the index where the strings begin to differ; -1 if they are all equal * @since 2.4 */ public static int indexOfDifference(String[] strs) { if (strs == null || strs.length <= 1) { return -1; } boolean anyStringNull = false; boolean allStringsNull = true; int arrayLen = strs.length; int shortestStrLen = Integer.MAX_VALUE; int longestStrLen = 0; // find the min and max string lengths; this avoids checking to make // sure we are not exceeding the length of the string each time through // the bottom loop. for (int i = 0; i < arrayLen; i++) { if (strs[i] == null) { anyStringNull = true; shortestStrLen = 0; } else { allStringsNull = false; shortestStrLen = Math.min(strs[i].length(), shortestStrLen); longestStrLen = Math.max(strs[i].length(), longestStrLen); } } // handle lists containing all nulls or all empty strings if (allStringsNull || (longestStrLen == 0 && !anyStringNull)) { return -1; } // handle lists containing some nulls or some empty strings if (shortestStrLen == 0) { return 0; } // find the position with the first difference across all strings int firstDiff = -1; for (int stringPos = 0; stringPos < shortestStrLen; stringPos++) { char comparisonChar = strs[0].charAt(stringPos); for (int arrayPos = 1; arrayPos < arrayLen; arrayPos++) { if (strs[arrayPos].charAt(stringPos) != comparisonChar) { firstDiff = stringPos; break; } } if (firstDiff != -1) { break; } } if (firstDiff == -1 && shortestStrLen != longestStrLen) { // we compared all of the characters up to the length of the // shortest string and didn't find a match, but the string lengths // vary, so return the length of the shortest string. return shortestStrLen; } return firstDiff; }
From source file:com.github.fge.jsonschema.syntax.checkers.helpers.PositiveIntegerSyntaxChecker.java
@Override protected void checkValue(final Collection<JsonPointer> pointers, final ProcessingReport report, final SchemaTree tree) throws ProcessingException { final JsonNode node = getNode(tree); if (!node.canConvertToInt()) { report.error(newMsg(tree, "integerTooLarge").put("max", Integer.MAX_VALUE)); return;//from w ww . j av a 2 s. com } if (node.intValue() < 0) report.error(newMsg(tree, "integerIsNegative")); }
From source file:com.athena.peacock.agent.netty.PeacockClientInitializer.java
@Override public void initChannel(SocketChannel ch) throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("decoder", new ObjectDecoder(Integer.MAX_VALUE, ClassResolvers.cacheDisabled(null))); pipeline.addLast("encoder", new ObjectEncoder()); pipeline.addLast("handler", handler); }
From source file:br.com.manish.ahy.kernel.util.FileUtil.java
public static byte[] readResourceAsBytes(String path) { byte[] byteData = null; try {/* w w w . j a v a 2 s . c om*/ InputStream is = FileUtil.class.getResourceAsStream(path); if (is.available() > Integer.MAX_VALUE) { throw new OopsException("Oversized file :-( can't read it, sorry: " + path); } ByteArrayOutputStream os = new ByteArrayOutputStream(1024); byte[] bytes = new byte[512]; int readBytes; while ((readBytes = is.read(bytes)) > 0) { os.write(bytes, 0, readBytes); } byteData = os.toByteArray(); is.close(); os.close(); } catch (Exception e) { throw new OopsException(e, "Problems when reading: [" + path + "]."); } return byteData; }
From source file:BoxSample.java
private static void changeHeight(JComponent comp) { comp.setAlignmentX(Component.CENTER_ALIGNMENT); comp.setAlignmentY(Component.CENTER_ALIGNMENT); Dimension dim = comp.getPreferredSize(); dim.height = Integer.MAX_VALUE; comp.setMaximumSize(dim);/*from ww w .j a va2 s .c o m*/ }
From source file:com.athena.peacock.controller.netty.PeacockServerInitializer.java
@Override public void initChannel(SocketChannel ch) throws Exception { // Create a default pipeline implementation. ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("decoder", new ObjectDecoder(Integer.MAX_VALUE, ClassResolvers.cacheDisabled(null))); pipeline.addLast("encoder", new ObjectEncoder()); pipeline.addLast("handler", new PeacockServerHandler()); }