Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.security.Principal;

public class Main {
    public static String toString(Principal[] principals) {
        if (principals == null || principals.length == 0) {
            return "<empty principals>";
        }
        StringBuffer buf = new StringBuffer();

        buf.append("<");
        for (int i = 0; i < principals.length; i++) {
            Principal p = principals[i];
            buf.append("(class=");
            buf.append(p.getClass());
            buf.append(", name=");
            buf.append(p.getName());
            buf.append(")");
            if (i < principals.length) {
                buf.append(", ");
            }

        }
        buf.append(">");

        return buf.toString();
    }
}