List of usage examples for java.lang Integer MIN_VALUE
int MIN_VALUE
To view the source code for java.lang Integer MIN_VALUE.
Click Source Link
From source file:NumberUtils.java
/** * Convert the given number into an instance of the given target class. * * @param number the number to convert * @param targetClass the target class to convert to * @return the converted number// w w w . j a v a2s . co m * @throws IllegalArgumentException if the target class is not supported * (i.e. not a standard Number subclass as included in the JDK) * @see java.lang.Byte * @see java.lang.Short * @see java.lang.Integer * @see java.lang.Long * @see java.math.BigInteger * @see java.lang.Float * @see java.lang.Double * @see java.math.BigDecimal */ public static Number convertNumberToTargetClass(Number number, Class targetClass) throws IllegalArgumentException { if (targetClass.isInstance(number)) { return number; } else if (targetClass.equals(Byte.class)) { long value = number.longValue(); if (value < Byte.MIN_VALUE || value > Byte.MAX_VALUE) { raiseOverflowException(number, targetClass); } return number.byteValue(); } else if (targetClass.equals(Short.class)) { long value = number.longValue(); if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { raiseOverflowException(number, targetClass); } return number.shortValue(); } else if (targetClass.equals(Integer.class)) { long value = number.longValue(); if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) { raiseOverflowException(number, targetClass); } return number.intValue(); } else if (targetClass.equals(Long.class)) { return number.longValue(); } else if (targetClass.equals(Float.class)) { return number.floatValue(); } else if (targetClass.equals(Double.class)) { return number.doubleValue(); } else if (targetClass.equals(BigInteger.class)) { return BigInteger.valueOf(number.longValue()); } else if (targetClass.equals(BigDecimal.class)) { // using BigDecimal(String) here, to avoid unpredictability of BigDecimal(double) // (see BigDecimal javadoc for details) return new BigDecimal(number.toString()); } else { throw new IllegalArgumentException("Could not convert number [" + number + "] of type [" + number.getClass().getName() + "] to unknown target class [" + targetClass.getName() + "]"); } }
From source file:com.home.ln_spring.ch5.lifecycle.SimpleBeanWithInterface.java
@Override public void afterPropertiesSet() throws Exception { System.out.println("Initialising bean"); if (name == null) { System.out.println("Using default name"); name = DEFAULT_NAME;/*from w w w. j av a 2 s . co m*/ } if (age == Integer.MIN_VALUE) { throw new IllegalArgumentException("You must set age property " + SimpleBean.class); } }
From source file:Main.java
public Main() { super("JLayeredPane Demo"); setSize(256, 256);/*w w w . j av a2 s . c o m*/ JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.setOpaque(false); JLabel label1 = new JLabel("Username:"); label1.setForeground(Color.white); content.add(label1); JTextField field = new JTextField(15); content.add(field); JLabel label2 = new JLabel("Password:"); label2.setForeground(Color.white); content.add(label2); JPasswordField fieldPass = new JPasswordField(15); content.add(fieldPass); setLayout(new FlowLayout()); add(content); ((JPanel) getContentPane()).setOpaque(false); ImageIcon earth = new ImageIcon("largeJava2sLogo.png"); JLabel backlabel = new JLabel(earth); getLayeredPane().add(backlabel, new Integer(Integer.MIN_VALUE)); backlabel.setBounds(0, 0, earth.getIconWidth(), earth.getIconHeight()); super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); }
From source file:org.kuali.maven.plugins.graph.util.Counter.java
public synchronized int decrement() { Assert.state(value > Integer.MIN_VALUE, "Minimum counter value exceeded"); return value--; }
From source file:com.redhat.smonkey.RndInt.java
@Override public JsonNode generate(JsonNodeFactory nodeFactory, JsonNode data, Monkey mon) { int min = Utils.asInt(data.get("min"), Integer.MIN_VALUE); int max = Utils.asInt(data.get("max"), Integer.MAX_VALUE); long x = Utils.rndi(min, max); return nodeFactory.numberNode(x); }
From source file:com.fitbur.core.el.spring.internal.SpelExpressionParserProvider.java
@Rank(Integer.MIN_VALUE) @Singleton @Override public ExpressionParser provide() { return new SpelExpressionParser(config); }
From source file:com.liferay.dynamic.data.mapping.form.evaluator.internal.functions.IsIntegerFunction.java
@Override public Object evaluate(Object... parameters) { if (parameters.length != 1) { throw new IllegalArgumentException("One parameter is expected"); }//from w ww . j a v a2 s. c om Integer value = NumberUtils.toInt(parameters[0].toString(), Integer.MIN_VALUE); return value != Integer.MIN_VALUE; }
From source file:web.config.LoggingAutoConfiguration.java
private FilterRegistrationBean createFilterRegistration(LoggingFilter filter) { FilterRegistrationBean registration = new FilterRegistrationBean(filter); registration.setOrder(Integer.MIN_VALUE); return registration; }
From source file:edu.byu.nlp.util.AbstractCounter.java
/** {@inheritDoc} */ @Override//from ww w .j a v a2 s . c o m public E argMax() { E argMax = null; int maxCount = Integer.MIN_VALUE; for (Entry<E, Integer> entry : entrySet()) { if (entry.getValue() > maxCount) { maxCount = entry.getValue(); argMax = entry.getKey(); } } return argMax; }
From source file:FramewithComponents.java
public FramewithComponents() { super("JLayeredPane Demo"); setSize(256, 256);// www . j ava2 s .com JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.setOpaque(false); JLabel label1 = new JLabel("Username:"); label1.setForeground(Color.white); content.add(label1); JTextField field = new JTextField(15); content.add(field); JLabel label2 = new JLabel("Password:"); label2.setForeground(Color.white); content.add(label2); JPasswordField fieldPass = new JPasswordField(15); content.add(fieldPass); getContentPane().setLayout(new FlowLayout()); getContentPane().add(content); ((JPanel) getContentPane()).setOpaque(false); ImageIcon earth = new ImageIcon("largeJava2sLogo.png"); JLabel backlabel = new JLabel(earth); getLayeredPane().add(backlabel, new Integer(Integer.MIN_VALUE)); backlabel.setBounds(0, 0, earth.getIconWidth(), earth.getIconHeight()); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); setVisible(true); }