Print a list in lines of 8 (java)

I need to print a list in lines of 8. Say if the list was integers long it would print 8 on the first row and 2 on the next. Here is my code:

for(int i = 0; i < size; i++){
    System.out.println(list[i] + " ");

How could I print it in lines of 8 instead of printing one per line?


Use StringBuilder:

 StringBuilder sb = new StringBuilder();
 sb.append(list[0]).append(" ");
 for (int i = 1 ; i < size; i++) {
      sb.append(list[i]).append(" ");
      if ( (i + 1) % 8 == 0 ) { sb.append("\n"); }

Need Your Help

TypeDescriptor.GetConverter() doesnt return my converter

c# .net reflection typedescriptor

I have a simple type with a custom type converter that is compiled and loaded at runtime. TypeDescriptor.GetConverter() doesn't find the right converter though. Here is a stand-alone example

Displaying a DialogFragment is confusing me

android android-fragments android-dialogfragment

I am going over the official Android tutorial for DialogFragments. The part that slightly confuses me is:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.