What are the Java equivalents of the C functions htons(), htonl(), ntohs(), and ntohl()?

Tim Rohaly

Java streams use Network Byte Order by default, so there is no need to convert to/from NBO in your Java application, hence no need for these functions. See also the FAQ at http://www.jguru.com/jguru/faq/view.jsp?EID=25977.