Question: This is basically the same question as [Implementing a C style bitfield in Java](https://stackoverflow.com/questions/12546106/implementing-a-c-style-bitfield-in-java). But is there a way of doing this in a typed fashion without resorting to using a class? As an example, here is some 'C' code:

```
typedef struct
{
    unsigned int x: 8;
    unsigned int y: 8;
} point;

point getPoint()
{
    point p;
    p.x = 1;
    p.y = 2;
    return p;
}

```

"point" is nicely typed and the compiler passes it around as an int primitive type, which is very efficient. In java, one might use a class to contain the point and then write:

```
point getPoint()
{
    return new point(1,2);
}

```

I am trying to improve a heavily recursive java game program that uses a class "point" (among other simple classes) and so the jvm is doing zillions of new operations and taking an enormous amount of time in garbage collection. Changing the class "point" into a packed int may or may not help, but its worth a shot. But I would like to have a nice type "point" to use in the program rather than just declaring "int" everywhere I use the point.

Answer: 
Permute will kill you on large arrays,... you can also try:

```
array= 0.001:0.001:1000;
A = repmat(reshape(array,1,1,numel(array)),[144 96 1]);

```
you could do it the following way:

```
array=0.001:0.001:1000;
M=permute(repmat(array,144,1,96),[1 3 2])

```

It looks like `repmat` doesn't like `[144,96,1]` so we will create it in other size and then just change the order of the dimensions with `permute`