The documentation for the receive() method of DatagramSocket says that the received message is truncated if the datagram packet buffer is not big enough to hold it.
The receive() method will silently discard any extra data if the supplied byte array is not large enough to hold it. This discarding behavior is the same as in BSD sockets. However, at the Java API level, there is no way to tell that this data has been discarded because the original packet length is only available in native code, and not propagated up to the Java implementation classes.
The easiest way of dealing with this issue is to avoid it entirely. A UDP packet can contain at most 65507 bytes (this is the 65535-byte IP packet size minus the minimum IP header of 20 bytes and minus the 8-byte UDP header). If you receive your datagrams into an array of at least this length, truncation will never happen.