code: public int encode() {
          // TODO Support missing genotypes
          int encoding = 0;
          for (int i = 0; i < allelesIdx.length; i++) {
              encoding += Math.pow(10, allelesIdx.length - i - 1) * allelesIdx[i]; 
          }
          
          return isPhased() ? encoding : encoding * (-1);
      }
docs: Each allele is encoded as the ith-power of 10, being i the index where it is placed. Then its value
  (0,1,2...) is multiplied by that power.
  
  Two genotypes with the same alleles but different phase will have different sign. Phased genotypes
  have positive encoding, whereas unphased ones have negative encoding.
  
  For instance, genotype 1/0 would be -10, 1|0 would be 10 and 2/1 would be -21.
  
  @return A numerical encoding of the genotype