Please open this page on a larger display
 

look at the program and start typing the same.

Reload Hide Keyboard
public static int getFreePort() {
    for (int i = 0; i < NUM_CANDIDATES; i++) {
        final int port = nextCandidatePort();
        final InetSocketAddress wildcardAddr = new InetSocketAddress(port);

        if (isTcpPortAvailable(wildcardAddr) &&
            isTcpPortAvailable(loopbackAddr) &&
            isUdpPortAvailable(wildcardAddr) &&
            isUdpPortAvailable(loopbackAddr)) {
            return port;
        }
    }

    throw new RuntimeException("unable to find a free port");
}
  • ~
    `
  • !
    1
  • @
    2
  • #
    3
  • $
    4
  • %
    5
  • ^
    6
  • &
    7
  • *
    8
  • (
    9
  • )
    0
  • _
    -
  • +
    =
  • Backspace
  • Tab
  • Q
  • W
  • E
  • R
  • T
  • Y
  • U
  • I
  • O
  • P
  • {
    [
  • }
    ]
  • |
    \
  • CapsLock
  • A
  • S
  • D
  • F
  • G
  • H
  • J
  • K
  • L
  • :
    ;
  • "
    '
  • Enter
  • Shift
  • Z
  • X
  • C
  • V
  • B
  • N
  • M
  • <
    ,
  • >
    .
  • ?
    /
  • Shift
  • Ctrl
  • Fn
  • win
  • Alt
  • Space bar
  • Alt
  • win
  • Ctrl

Loading...