public static int distanceFinderZValue(double[] vector){
  StringBuilder binaryBuffer=new StringBuilder();
  List<String> binaryReps=new ArrayList<>(vector.length);
  for (  double d : vector) {
    int j=(int)d;
    String binary=Integer.toBinaryString(j);
    binaryReps.add(binary);
  }
  while (!binaryReps.isEmpty()) {
    for (int j=0; j < binaryReps.size(); j++) {
      String curr=binaryReps.get(j);
      if (!curr.isEmpty()) {
        char first=curr.charAt(0);
        binaryBuffer.append(first);
        curr=curr.substring(1);
        binaryReps.set(j,curr);
      }
 else       binaryReps.remove(j);
    }
  }
  return Integer.parseInt(binaryBuffer.toString(),2);
}

public static int distanceFinderZValue ( double [ ] vector ) { StringBuilder binaryBuffer = new StringBuilder ( ) ; List < String > binaryReps = new ArrayList < > ( vector . length ) ; for ( double d : vector ) { int j = ( int ) d ; String binary = Integer . toBinaryString ( j ) ; binaryReps . add ( binary ) ; } while ( ! binaryReps . isEmpty ( ) ) { for ( int j = 0 ; j < binaryReps . size ( ) ; j ++ ) { String curr = binaryReps . get ( j ) ; if ( ! curr . isEmpty ( ) ) { char first = curr . charAt ( 0 ) ; binaryBuffer . append ( first ) ; curr = curr . substring ( 1 ) ; binaryReps . set ( j , curr ) ; } else binaryReps . remove ( j ) ; } } return Integer . parseInt ( binaryBuffer . toString ( ) , 2 ) ; }
this will translate a vector in to an equivalent integer
