How to split an array into multi arrays in java? [duplicate]










2
















This question already has an answer here:



  • How to split a string array into small chunk arrays in java?

    9 answers



I have an array



[2,5,7,9,1,3,4,6,8]


and I want a function



List<List<Integer>> split(List<Integer> list, int n)


which will separate the list intonarrays



for example:n=4,
result will be:



[2,1,8],
[5,3],
[7,4],
[9,6]


Note, the number was sampled averagely










share|improve this question















marked as duplicate by Raedwald, Paul, MC Emperor, Mark Rotteveel java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 16:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Do you want a random separation?

    – Alon
    Nov 13 '18 at 9:25






  • 1





    @Turamarth the order is not same

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 1





    @Alon sample averagely

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 2





    What have you tried so far? I don't see any problems here. Implementing split is rather straight forward.

    – Socowi
    Nov 13 '18 at 9:27











  • @Turamarth The input in that case appears to specifying the size of the chunks, where in this case it would be the number of chunks.

    – Michael
    Nov 13 '18 at 9:56















2
















This question already has an answer here:



  • How to split a string array into small chunk arrays in java?

    9 answers



I have an array



[2,5,7,9,1,3,4,6,8]


and I want a function



List<List<Integer>> split(List<Integer> list, int n)


which will separate the list intonarrays



for example:n=4,
result will be:



[2,1,8],
[5,3],
[7,4],
[9,6]


Note, the number was sampled averagely










share|improve this question















marked as duplicate by Raedwald, Paul, MC Emperor, Mark Rotteveel java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 16:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Do you want a random separation?

    – Alon
    Nov 13 '18 at 9:25






  • 1





    @Turamarth the order is not same

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 1





    @Alon sample averagely

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 2





    What have you tried so far? I don't see any problems here. Implementing split is rather straight forward.

    – Socowi
    Nov 13 '18 at 9:27











  • @Turamarth The input in that case appears to specifying the size of the chunks, where in this case it would be the number of chunks.

    – Michael
    Nov 13 '18 at 9:56













2












2








2









This question already has an answer here:



  • How to split a string array into small chunk arrays in java?

    9 answers



I have an array



[2,5,7,9,1,3,4,6,8]


and I want a function



List<List<Integer>> split(List<Integer> list, int n)


which will separate the list intonarrays



for example:n=4,
result will be:



[2,1,8],
[5,3],
[7,4],
[9,6]


Note, the number was sampled averagely










share|improve this question

















This question already has an answer here:



  • How to split a string array into small chunk arrays in java?

    9 answers



I have an array



[2,5,7,9,1,3,4,6,8]


and I want a function



List<List<Integer>> split(List<Integer> list, int n)


which will separate the list intonarrays



for example:n=4,
result will be:



[2,1,8],
[5,3],
[7,4],
[9,6]


Note, the number was sampled averagely





This question already has an answer here:



  • How to split a string array into small chunk arrays in java?

    9 answers







java






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 9:26







Jimmy Guo

















asked Nov 13 '18 at 9:22









Jimmy GuoJimmy Guo

548414




548414




marked as duplicate by Raedwald, Paul, MC Emperor, Mark Rotteveel java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 16:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Raedwald, Paul, MC Emperor, Mark Rotteveel java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 13 '18 at 16:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    Do you want a random separation?

    – Alon
    Nov 13 '18 at 9:25






  • 1





    @Turamarth the order is not same

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 1





    @Alon sample averagely

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 2





    What have you tried so far? I don't see any problems here. Implementing split is rather straight forward.

    – Socowi
    Nov 13 '18 at 9:27











  • @Turamarth The input in that case appears to specifying the size of the chunks, where in this case it would be the number of chunks.

    – Michael
    Nov 13 '18 at 9:56












  • 1





    Do you want a random separation?

    – Alon
    Nov 13 '18 at 9:25






  • 1





    @Turamarth the order is not same

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 1





    @Alon sample averagely

    – Jimmy Guo
    Nov 13 '18 at 9:25






  • 2





    What have you tried so far? I don't see any problems here. Implementing split is rather straight forward.

    – Socowi
    Nov 13 '18 at 9:27











  • @Turamarth The input in that case appears to specifying the size of the chunks, where in this case it would be the number of chunks.

    – Michael
    Nov 13 '18 at 9:56







1




1





Do you want a random separation?

– Alon
Nov 13 '18 at 9:25





Do you want a random separation?

– Alon
Nov 13 '18 at 9:25




1




1





@Turamarth the order is not same

– Jimmy Guo
Nov 13 '18 at 9:25





@Turamarth the order is not same

– Jimmy Guo
Nov 13 '18 at 9:25




1




1





@Alon sample averagely

– Jimmy Guo
Nov 13 '18 at 9:25





@Alon sample averagely

– Jimmy Guo
Nov 13 '18 at 9:25




2




2





What have you tried so far? I don't see any problems here. Implementing split is rather straight forward.

– Socowi
Nov 13 '18 at 9:27





What have you tried so far? I don't see any problems here. Implementing split is rather straight forward.

– Socowi
Nov 13 '18 at 9:27













@Turamarth The input in that case appears to specifying the size of the chunks, where in this case it would be the number of chunks.

– Michael
Nov 13 '18 at 9:56





@Turamarth The input in that case appears to specifying the size of the chunks, where in this case it would be the number of chunks.

– Michael
Nov 13 '18 at 9:56












4 Answers
4






active

oldest

votes


















3














Try this:



public static ArrayList<ArrayList<Integer>> split(ArrayList<Integer> list, int n)
ArrayList<ArrayList<Integer>> resultArrays = new ArrayList<>();
int pivot = 0;

// Creates n ArrayLists.
for(int i = 0 ; i < n ; i++)
resultArrays.add(new ArrayList<>());


// Add element from list to new ArrayLists.
while(pivot != list.size())
int p = pivot%n;
resultArrays.get(p).add(list.get(pivot));
pivot++;


return resultArrays;



The result is the one you exactly you want.



[2,1,8],
[5,3],
[7,4],
[9,6]


pivot points list's element.(from 0 to the size-1)



p points the ArrayList of ArrayList's index.(As big as n, here 4)



So,



num / *(pivot) / ArrayList[p]

1: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
*
2: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
*
3: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
*
4: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
*
5: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
*
6: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
*
7: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
*
8: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
*
9: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
*





share|improve this answer
































    1














    Given a number of bins.



    List<List<Integer>> result = new ArrayList<>();
    while(result.size()<bins)
    result.add(new ArrayList<>());


    int counter = 0;
    for(Integer i: input)
    result.get(counter++%bins).add(i);






    share|improve this answer






























      0














      In Guava library there is a List.Partition method.



      List<List<Integer>> split(List<Integer> list, int n) 
      return Lists.partition(list, n);






      share|improve this answer























      • This is not what OP wants. Have a close look at the expected output. The order is different.

        – Socowi
        Nov 13 '18 at 9:28


















      0














      List<List<Integer>> split(List<Integer> list, int n)
      List<List<Integer>> result = new ArrayList<>();
      //add n ArrayLists to the result list
      IntStream.range(0, n).forEach(k->result.add(new ArrayList<>()));
      //iterate over the input list and add one element to one of the inner list of the result array
      Iterator i = list.iterator();
      while(i.hasNext())
      int count = 0;
      while(i.hasNext() && count < n)
      result.get(count).add((Integer) i.next());
      count++;


      return result;






      share|improve this answer





























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3














        Try this:



        public static ArrayList<ArrayList<Integer>> split(ArrayList<Integer> list, int n)
        ArrayList<ArrayList<Integer>> resultArrays = new ArrayList<>();
        int pivot = 0;

        // Creates n ArrayLists.
        for(int i = 0 ; i < n ; i++)
        resultArrays.add(new ArrayList<>());


        // Add element from list to new ArrayLists.
        while(pivot != list.size())
        int p = pivot%n;
        resultArrays.get(p).add(list.get(pivot));
        pivot++;


        return resultArrays;



        The result is the one you exactly you want.



        [2,1,8],
        [5,3],
        [7,4],
        [9,6]


        pivot points list's element.(from 0 to the size-1)



        p points the ArrayList of ArrayList's index.(As big as n, here 4)



        So,



        num / *(pivot) / ArrayList[p]

        1: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
        *
        2: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
        *
        3: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
        *
        4: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
        *
        5: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
        *
        6: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
        *
        7: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
        *
        8: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
        *
        9: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
        *





        share|improve this answer





























          3














          Try this:



          public static ArrayList<ArrayList<Integer>> split(ArrayList<Integer> list, int n)
          ArrayList<ArrayList<Integer>> resultArrays = new ArrayList<>();
          int pivot = 0;

          // Creates n ArrayLists.
          for(int i = 0 ; i < n ; i++)
          resultArrays.add(new ArrayList<>());


          // Add element from list to new ArrayLists.
          while(pivot != list.size())
          int p = pivot%n;
          resultArrays.get(p).add(list.get(pivot));
          pivot++;


          return resultArrays;



          The result is the one you exactly you want.



          [2,1,8],
          [5,3],
          [7,4],
          [9,6]


          pivot points list's element.(from 0 to the size-1)



          p points the ArrayList of ArrayList's index.(As big as n, here 4)



          So,



          num / *(pivot) / ArrayList[p]

          1: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
          *
          2: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
          *
          3: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
          *
          4: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
          *
          5: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
          *
          6: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
          *
          7: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
          *
          8: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
          *
          9: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
          *





          share|improve this answer



























            3












            3








            3







            Try this:



            public static ArrayList<ArrayList<Integer>> split(ArrayList<Integer> list, int n)
            ArrayList<ArrayList<Integer>> resultArrays = new ArrayList<>();
            int pivot = 0;

            // Creates n ArrayLists.
            for(int i = 0 ; i < n ; i++)
            resultArrays.add(new ArrayList<>());


            // Add element from list to new ArrayLists.
            while(pivot != list.size())
            int p = pivot%n;
            resultArrays.get(p).add(list.get(pivot));
            pivot++;


            return resultArrays;



            The result is the one you exactly you want.



            [2,1,8],
            [5,3],
            [7,4],
            [9,6]


            pivot points list's element.(from 0 to the size-1)



            p points the ArrayList of ArrayList's index.(As big as n, here 4)



            So,



            num / *(pivot) / ArrayList[p]

            1: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
            *
            2: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
            *
            3: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
            *
            4: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
            *
            5: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
            *
            6: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
            *
            7: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
            *
            8: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
            *
            9: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
            *





            share|improve this answer















            Try this:



            public static ArrayList<ArrayList<Integer>> split(ArrayList<Integer> list, int n)
            ArrayList<ArrayList<Integer>> resultArrays = new ArrayList<>();
            int pivot = 0;

            // Creates n ArrayLists.
            for(int i = 0 ; i < n ; i++)
            resultArrays.add(new ArrayList<>());


            // Add element from list to new ArrayLists.
            while(pivot != list.size())
            int p = pivot%n;
            resultArrays.get(p).add(list.get(pivot));
            pivot++;


            return resultArrays;



            The result is the one you exactly you want.



            [2,1,8],
            [5,3],
            [7,4],
            [9,6]


            pivot points list's element.(from 0 to the size-1)



            p points the ArrayList of ArrayList's index.(As big as n, here 4)



            So,



            num / *(pivot) / ArrayList[p]

            1: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
            *
            2: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
            *
            3: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
            *
            4: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
            *
            5: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
            *
            6: [2,5,7,9,1,3,4,6,8] -> ArrayList[1]
            *
            7: [2,5,7,9,1,3,4,6,8] -> ArrayList[2]
            *
            8: [2,5,7,9,1,3,4,6,8] -> ArrayList[3]
            *
            9: [2,5,7,9,1,3,4,6,8] -> ArrayList[0]
            *






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 13 '18 at 10:12

























            answered Nov 13 '18 at 10:00









            c-anc-an

            567426




            567426























                1














                Given a number of bins.



                List<List<Integer>> result = new ArrayList<>();
                while(result.size()<bins)
                result.add(new ArrayList<>());


                int counter = 0;
                for(Integer i: input)
                result.get(counter++%bins).add(i);






                share|improve this answer



























                  1














                  Given a number of bins.



                  List<List<Integer>> result = new ArrayList<>();
                  while(result.size()<bins)
                  result.add(new ArrayList<>());


                  int counter = 0;
                  for(Integer i: input)
                  result.get(counter++%bins).add(i);






                  share|improve this answer

























                    1












                    1








                    1







                    Given a number of bins.



                    List<List<Integer>> result = new ArrayList<>();
                    while(result.size()<bins)
                    result.add(new ArrayList<>());


                    int counter = 0;
                    for(Integer i: input)
                    result.get(counter++%bins).add(i);






                    share|improve this answer













                    Given a number of bins.



                    List<List<Integer>> result = new ArrayList<>();
                    while(result.size()<bins)
                    result.add(new ArrayList<>());


                    int counter = 0;
                    for(Integer i: input)
                    result.get(counter++%bins).add(i);







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 13 '18 at 9:27









                    mattmatt

                    4,33411226




                    4,33411226





















                        0














                        In Guava library there is a List.Partition method.



                        List<List<Integer>> split(List<Integer> list, int n) 
                        return Lists.partition(list, n);






                        share|improve this answer























                        • This is not what OP wants. Have a close look at the expected output. The order is different.

                          – Socowi
                          Nov 13 '18 at 9:28















                        0














                        In Guava library there is a List.Partition method.



                        List<List<Integer>> split(List<Integer> list, int n) 
                        return Lists.partition(list, n);






                        share|improve this answer























                        • This is not what OP wants. Have a close look at the expected output. The order is different.

                          – Socowi
                          Nov 13 '18 at 9:28













                        0












                        0








                        0







                        In Guava library there is a List.Partition method.



                        List<List<Integer>> split(List<Integer> list, int n) 
                        return Lists.partition(list, n);






                        share|improve this answer













                        In Guava library there is a List.Partition method.



                        List<List<Integer>> split(List<Integer> list, int n) 
                        return Lists.partition(list, n);







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Nov 13 '18 at 9:27









                        Khalid ShahKhalid Shah

                        1,62921021




                        1,62921021












                        • This is not what OP wants. Have a close look at the expected output. The order is different.

                          – Socowi
                          Nov 13 '18 at 9:28

















                        • This is not what OP wants. Have a close look at the expected output. The order is different.

                          – Socowi
                          Nov 13 '18 at 9:28
















                        This is not what OP wants. Have a close look at the expected output. The order is different.

                        – Socowi
                        Nov 13 '18 at 9:28





                        This is not what OP wants. Have a close look at the expected output. The order is different.

                        – Socowi
                        Nov 13 '18 at 9:28











                        0














                        List<List<Integer>> split(List<Integer> list, int n)
                        List<List<Integer>> result = new ArrayList<>();
                        //add n ArrayLists to the result list
                        IntStream.range(0, n).forEach(k->result.add(new ArrayList<>()));
                        //iterate over the input list and add one element to one of the inner list of the result array
                        Iterator i = list.iterator();
                        while(i.hasNext())
                        int count = 0;
                        while(i.hasNext() && count < n)
                        result.get(count).add((Integer) i.next());
                        count++;


                        return result;






                        share|improve this answer



























                          0














                          List<List<Integer>> split(List<Integer> list, int n)
                          List<List<Integer>> result = new ArrayList<>();
                          //add n ArrayLists to the result list
                          IntStream.range(0, n).forEach(k->result.add(new ArrayList<>()));
                          //iterate over the input list and add one element to one of the inner list of the result array
                          Iterator i = list.iterator();
                          while(i.hasNext())
                          int count = 0;
                          while(i.hasNext() && count < n)
                          result.get(count).add((Integer) i.next());
                          count++;


                          return result;






                          share|improve this answer

























                            0












                            0








                            0







                            List<List<Integer>> split(List<Integer> list, int n)
                            List<List<Integer>> result = new ArrayList<>();
                            //add n ArrayLists to the result list
                            IntStream.range(0, n).forEach(k->result.add(new ArrayList<>()));
                            //iterate over the input list and add one element to one of the inner list of the result array
                            Iterator i = list.iterator();
                            while(i.hasNext())
                            int count = 0;
                            while(i.hasNext() && count < n)
                            result.get(count).add((Integer) i.next());
                            count++;


                            return result;






                            share|improve this answer













                            List<List<Integer>> split(List<Integer> list, int n)
                            List<List<Integer>> result = new ArrayList<>();
                            //add n ArrayLists to the result list
                            IntStream.range(0, n).forEach(k->result.add(new ArrayList<>()));
                            //iterate over the input list and add one element to one of the inner list of the result array
                            Iterator i = list.iterator();
                            while(i.hasNext())
                            int count = 0;
                            while(i.hasNext() && count < n)
                            result.get(count).add((Integer) i.next());
                            count++;


                            return result;







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 13 '18 at 11:17









                            EritreanEritrean

                            3,80511015




                            3,80511015













                                Popular posts from this blog

                                𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

                                Malaysia to Papua New Guinea by motorcycle?

                                PHP code is not being executed, instead code shows on the page