Function c++ ,equivalent in java
<p>I have the following problem, the following program is in c + +.;</p>

<pre><code>#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;malloc.h&gt;

typedef enum { TR, SYS, INT, BAT } TIPOS ;
typedef enum { LIBRE , EJECUCION , LISTO , BLOQUEADO } PCBestado ;

struct PCB {
   int PID;
   PCBestado estado ;
   TIPOS tipo ;
   int mem , dir ;long hora , totalCPU , UsoContCPU, consumidoCPU, consContCPU;
   struct PCB * sig , *ant ;
};

struct PCB *libres = NULL;

// something
....
...
..
/// function for list
void iniPCBpool( int n )
{
    int f ;
    struct PCB ** p ,
    *ant = NULL ;
    for( p = &amp;libres , f = 0 ; f &lt; n ; f++ ) 
    {
       if( ( *p = (struct PCB *)malloc( sizeof( struct PCB ) ) ) == NULL )
       terror("Sin memoria");

       (*p)-&gt;ant = ant;
       ant = *p ;
       p = &amp;(*p)-&gt;sig ;
    }
    *p = NULL ;
}
</code></pre>

<p>what I need is to make this code but in java.</p>

<p>Help me, please. Thanks.</p>
