/*
* JMule - Java file sharing client
* Copyright (C) 2007-2008 JMule team ( jmule@jmule.org / http://jmule.org )
*
* Any parts of this program derived from other projects, or contributed
* by third-party developers are copyrighted by their respective authors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
//package com.nowjava;
/*
N o w J a v a . c o m 提 供
*/
public class Main {
public static void main(String[] argv) throws Exception {
int port = 2;
System.out.println(isPortInRange(port));
}
/**
* Validates a port value if it is in range ( 1 - 65535 )
*
* @param port the port to verify in int value. Unsigned short ports must be
* converted to singned int to let this function work correctly.
* @return true if the port is in range, false otherwise.
*/
public static boolean isPortInRange(int port) {
return (port & 0xFFFF0000) == 0 && port != 0;
}
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。