1/* There is no such method in the standard Java SE class library.
2All primitive values have a predefined size, e.g. int is 4 bytes,
3char is 2 byte, short is 2 byte, long and float is 8 byte, and so on.
4
5 A class to count sizeof primitive */
6
7public class PrimitiveSizes {
8 public static int sizeof(byte b) { return 1; }
9 public static int sizeof(short s) { return 2; }
10 // etcetera
11}