Allows to check a double is negative. - Java java.lang

Java examples for java.lang:double Parse

Description

Allows to check a double is negative.

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        String str = "java2s.com";
        System.out.println(isDoubleNegative(str));
    }//from  w  ww  .j a  va  2s.c o m

    /**
     * Allows to check a double is negative.
     * @param str
     *            the string to check
     * @return true if the double is negative, false otherwise
     */
    public static boolean isDoubleNegative(final String str) {
        if (Double.valueOf(str) > 0) {
            return false;
        }
        return true;
    }
}

Related Tutorials