class ValidationUtils {

    public static boolean bboxIsValid( String bbox )
    {
        if ( bbox == null || bbox.trim().isEmpty() )
        {
            return false;
        }

        Matcher matcher = BBOX_PATTERN.matcher( bbox );

        if ( !matcher.matches() )
        {
            return false;
        }

        double minLng = Double.parseDouble( matcher.group( 1 ) );
        double minLat = Double.parseDouble( matcher.group( 4 ) );
        double maxLng = Double.parseDouble( matcher.group( 7 ) );
        double maxLat = Double.parseDouble( matcher.group( 10 ) );

        if ( minLng < -180d || minLng > 180d || maxLng < -180d || maxLng > 180d )
        {
            return false;
        }

        if ( minLat < -90d || minLat > 90d || maxLat < -90d || maxLat > 90d )
        {
            return false;
        }

        return true;
    }

}