This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Python's struct.pack in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Reply locked New topic

Python's struct.pack in Java

thiruvadi esakki

Joined: Jul 09, 2010
Posts: 1
Is there any function equivalent to Python's struct.pack in Java that allows me to pack and unpack values like this?

pump_on = struct.pack("IIHHI", 0, 0, 21, 96, 512)

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Same question as, closing this one.

If you have two accounts, let us now which one you want to keep so that we can close the other one.
I agree. Here's the link:
subject: Python's struct.pack in Java
It's not a secret anymore!