0

hello guys,
i have this code in java.but i need to convert to c.but i dont know java at all.hope u can help me.thanks for advance

public class Main
 {
    static int t_value=2;
    static int no_of_parameter = 0;
    String binary_setting;
    static int data[];
    static ArrayList<String> constraint = new ArrayList<String>();
    static ArrayList<String> seeding = new ArrayList<String>();
    static ArrayList<String> binary_cmd_list = new ArrayList<String>();
    static ArrayList<String> test_suite_list = new ArrayList<String>();


    public static void main (String[] args)
    {

     // reads the command line options
     for (int i=0;i<args.length;i++)
       {
         if (args[i].equals ("-i"))
           {
             String data_str = new String();
             // specify data values
             if (i+1<args.length)
              {
                i++;
                System.out.println ("Parameter =>"+args[i]);
                data_str = args[i];
              }
              // assign data values automatically to data by commas
              StringTokenizer s = new StringTokenizer (data_str,",");
              // count parameter
              int p = data_str.replaceAll("[^,]","").length();
              p++; // as an array size
              data = new int [p];
              int k =0;
              while (s.hasMoreTokens())
               {
                 data[k]=Integer.parseInt(s.nextToken());
                 k++;
               }
             }
            else if (args[i].equals ("-c"))
              {
                String c_str = new String();
                // specify variable strength values
                if (i+1<args.length)
                 {
                   i++;
                   System.out.println ("Constraints =>"+args[i]);
                   c_str = args[i];
                 }
                 // assign variable strength automatically to data by commas
                StringTokenizer s = new StringTokenizer (c_str,",");
                while (s.hasMoreTokens())
                  {
                    constraint.add(s.nextToken());
                  }
              }

       }

     generate_binary_input_combinations (t_value,binary_cmd_list);
     generate_test_set (binary_cmd_list,test_suite_list);
     display_list ("Final Pairwise Test Suite List",test_suite_list);

  }
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by yellowSnow
0

What should you do? Learn Java. It's going to be difficult to do the translation if you don't know the language you're translating to or from.

At any rate, a line-by line translation is not going to be possible as you will have to write equivalent C code to emulate the Java classes used e.g. ArrayList.

Edited by yellowSnow: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.