// Path: src/main/java/uk/org/okapibarcode/backend/DataBarLimited.java
// static int[] getWidths(int val, int n, int elements, int maxWidth, int noNarrow) {
// 
//     int bar;
//     int elmWidth;
//     int mxwElement;
//     int subVal, lessVal;
//     int narrowMask = 0;
//     int[] widths = new int[elements];
// 
//     for (bar = 0; bar < elements - 1; bar++) {
//         for (elmWidth = 1, narrowMask |= (1 << bar); ;
//                 elmWidth++, narrowMask &= ~ (1 << bar)) {
//             /* get all combinations */
//             subVal = getCombinations(n - elmWidth - 1, elements - bar - 2);
//             /* less combinations with no single-module element */
//             if ((noNarrow == 0) && (narrowMask == 0)
//                     && (n - elmWidth - (elements - bar - 1) >= elements - bar - 1)) {
//                 subVal -= getCombinations(n - elmWidth - (elements - bar), elements - bar - 2);
//             }
//             /* less combinations with elements > maxVal */
//             if (elements - bar - 1 > 1) {
//                 lessVal = 0;
//                 for (mxwElement = n - elmWidth - (elements - bar - 2);
//                 mxwElement > maxWidth;
//                 mxwElement--) {
//                     lessVal += getCombinations(n - elmWidth - mxwElement - 1, elements - bar - 3);
//                 }
//                 subVal -= lessVal * (elements - 1 - bar);
//             } else if (n - elmWidth > maxWidth) {
//                 subVal--;
//             }
//             val -= subVal;
//             if (val < 0) break;
//         }
//         val += subVal;
//         n -= elmWidth;
//         widths[bar] = elmWidth;
//     }
// 
//     widths[bar] = n;
// 
//     return widths;
// }


import static uk.org.okapibarcode.backend.DataBarLimited.getWidths;
import java.math.BigInteger;
            data_group[3] = 8;
        }
        if (data_character[2] >= 0 && data_character[2] <= 160) {
            data_group[2] = 0;
        }
        if (data_character[2] >= 161 && data_character[2] <= 960) {
            data_group[2] = 1;
        }
        if (data_character[2] >= 961 && data_character[2] <= 2014) {
            data_group[2] = 2;
        }
        if (data_character[2] >= 2015 && data_character[2] <= 2714) {
            data_group[2] = 3;
        }
        if (data_character[2] >= 2715 && data_character[2] <= 2840) {
            data_group[2] = 4;
        }

        v_odd[0] = (data_character[0] - G_SUM_TABLE[data_group[0]]) / T_TABLE[data_group[0]];
        v_even[0] = (data_character[0] - G_SUM_TABLE[data_group[0]]) % T_TABLE[data_group[0]];
        v_odd[1] = (data_character[1] - G_SUM_TABLE[data_group[1]]) % T_TABLE[data_group[1]];
        v_even[1] = (data_character[1] - G_SUM_TABLE[data_group[1]]) / T_TABLE[data_group[1]];
        v_odd[3] = (data_character[3] - G_SUM_TABLE[data_group[3]]) % T_TABLE[data_group[3]];
        v_even[3] = (data_character[3] - G_SUM_TABLE[data_group[3]]) / T_TABLE[data_group[3]];
        v_odd[2] = (data_character[2] - G_SUM_TABLE[data_group[2]]) / T_TABLE[data_group[2]];
        v_even[2] = (data_character[2] - G_SUM_TABLE[data_group[2]]) % T_TABLE[data_group[2]];

        /* Use RSS subset width algorithm */
        for (i = 0; i < 4; i++) {
            if ((i == 0) || (i == 2)) {
// Path: src/main/java/uk/org/okapibarcode/backend/DataBarLimited.java
// static int[] getWidths(int val, int n, int elements, int maxWidth, int noNarrow) {
// 
//     int bar;
//     int elmWidth;
//     int mxwElement;
//     int subVal, lessVal;
//     int narrowMask = 0;
//     int[] widths = new int[elements];
// 
//     for (bar = 0; bar < elements - 1; bar++) {
//         for (elmWidth = 1, narrowMask |= (1 << bar); ;
//                 elmWidth++, narrowMask &= ~ (1 << bar)) {
//             /* get all combinations */
//             subVal = getCombinations(n - elmWidth - 1, elements - bar - 2);
//             /* less combinations with no single-module element */
//             if ((noNarrow == 0) && (narrowMask == 0)
//                     && (n - elmWidth - (elements - bar - 1) >= elements - bar - 1)) {
//                 subVal -= getCombinations(n - elmWidth - (elements - bar), elements - bar - 2);
//             }
//             /* less combinations with elements > maxVal */
//             if (elements - bar - 1 > 1) {
//                 lessVal = 0;
//                 for (mxwElement = n - elmWidth - (elements - bar - 2);
//                 mxwElement > maxWidth;
//                 mxwElement--) {
//                     lessVal += getCombinations(n - elmWidth - mxwElement - 1, elements - bar - 3);
//                 }
//                 subVal -= lessVal * (elements - 1 - bar);
//             } else if (n - elmWidth > maxWidth) {
//                 subVal--;
//             }
//             val -= subVal;
//             if (val < 0) break;
//         }
//         val += subVal;
//         n -= elmWidth;
//         widths[bar] = elmWidth;
//     }
// 
//     widths[bar] = n;
// 
//     return widths;
// }


// Path: src/main/java/uk/org/okapibarcode/backend/DataBar14.java
import static uk.org.okapibarcode.backend.DataBarLimited.getWidths;
import java.math.BigInteger;

            data_group[3] = 8;
        }
        if (data_character[2] >= 0 && data_character[2] <= 160) {
            data_group[2] = 0;
        }
        if (data_character[2] >= 161 && data_character[2] <= 960) {
            data_group[2] = 1;
        }
        if (data_character[2] >= 961 && data_character[2] <= 2014) {
            data_group[2] = 2;
        }
        if (data_character[2] >= 2015 && data_character[2] <= 2714) {
            data_group[2] = 3;
        }
        if (data_character[2] >= 2715 && data_character[2] <= 2840) {
            data_group[2] = 4;
        }

        v_odd[0] = (data_character[0] - G_SUM_TABLE[data_group[0]]) / T_TABLE[data_group[0]];
        v_even[0] = (data_character[0] - G_SUM_TABLE[data_group[0]]) % T_TABLE[data_group[0]];
        v_odd[1] = (data_character[1] - G_SUM_TABLE[data_group[1]]) % T_TABLE[data_group[1]];
        v_even[1] = (data_character[1] - G_SUM_TABLE[data_group[1]]) / T_TABLE[data_group[1]];
        v_odd[3] = (data_character[3] - G_SUM_TABLE[data_group[3]]) % T_TABLE[data_group[3]];
        v_even[3] = (data_character[3] - G_SUM_TABLE[data_group[3]]) / T_TABLE[data_group[3]];
        v_odd[2] = (data_character[2] - G_SUM_TABLE[data_group[2]]) / T_TABLE[data_group[2]];
        v_even[2] = (data_character[2] - G_SUM_TABLE[data_group[2]]) % T_TABLE[data_group[2]];

        /* Use RSS subset width algorithm */
        for (i = 0; i < 4; i++) {
            if ((i == 0) || (i == 2)) {
                int[] widths = getWidths(v_odd[i], MODULES_ODD[data_group[i]], 4, WIDEST_ODD[data_group[i]], 1);