public static final double[] toDoubleArray(int i,int L){
  double u[]=new double[L];
  if (i == 0)   return u;
  String s=Integer.toBinaryString(i);
  for (int j=0; j < s.length(); j++) {
    u[j]=(double)Integer.parseInt(String.valueOf(s.charAt(j)));
  }
  return u;
}

public static final double [ ] toDoubleArray ( int i , int L ) { double u [ ] = new double [ L ] ; if ( i == 0 ) return u ; String s = Integer . toBinaryString ( i ) ; for ( int j = 0 ; j < s . length ( ) ; j ++ ) { u [ j ] = ( double ) Integer . parseInt ( String . valueOf ( s . charAt ( j ) ) ) ; } return u ; }
convert integer to binary string ( double representation ) of l digits . e . g . , todoublearray ( 3 , 4 ) = [ 0 . , 0 . , 1 . , 1 . ]
