Java ByteBuffer: How to use flip() and compact() This demo shows how a Java ByteBuffer and its flip() and compact() methods work. The code belongs to this article: English: Java ByteBuffer: How to use flip() and compact() German: Java ByteBuffer: Wie funktionieren flip() und compact()