// Path: src/main/java/org/fest/util/Arrays.java
// public static boolean isArray(@Nullable Object o) {
//   return o != null && o.getClass().isArray();
// }
// 
// Path: src/main/java/org/fest/util/Sets.java
// public static @NotNull <T> HashSet<T> newHashSet() {
//   return new HashSet<T>();
// }
// 
// Path: src/main/java/org/fest/util/ToString.java
// public static @Nullable String toStringOf(@Nullable Object o) {
//   if (isArray(o)) {
//     return Arrays.format(o);
//   }
//   if (o instanceof Calendar) {
//     return toStringOf(o);
//   }
//   if (o instanceof Class<?>) {
//     return toStringOf((Class<?>) o);
//   }
//   if (o instanceof Collection<?>) {
//     return toStringOf((Collection<?>) o);
//   }
//   if (o instanceof Date) {
//     return toStringOf(o);
//   }
//   if (o instanceof Float) {
//     return toStringOf((Float) o);
//   }
//   if (o instanceof Long) {
//     return toStringOf((Long) o);
//   }
//   if (o instanceof File) {
//     return toStringOf((File) o);
//   }
//   if (o instanceof Map<?, ?>) {
//     return toStringOf((Map<?, ?>) o);
//   }
//   if (o instanceof String) {
//     return quote((String) o);
//   }
//   if (o instanceof Comparator) {
//     return toStringOf((Comparator<?>) o);
//   }
//   return o == null ? null : o.toString();
// }


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Array;
import java.util.HashSet;
import java.util.Set;
import static java.lang.reflect.Array.getLength;
import static org.fest.util.Arrays.isArray;
import static org.fest.util.Sets.newHashSet;
import static org.fest.util.ToString.toStringOf;
/*
 * Created on Mar 29, 2009
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 * 
 * Copyright @2009-2013 the original author or authors.
 */
package org.fest.util;




/**
 * Creates a {@code String} representation of an array.
 *
 * @author Alex Ruiz
 * @author Joel Costigliola
 */
final class ArrayFormatter {
  private static final String NULL = "null";

  @Nullable String format(@Nullable Object o) {
// Path: src/main/java/org/fest/util/Arrays.java
// public static boolean isArray(@Nullable Object o) {
//   return o != null && o.getClass().isArray();
// }
// 
// Path: src/main/java/org/fest/util/Sets.java
// public static @NotNull <T> HashSet<T> newHashSet() {
//   return new HashSet<T>();
// }
// 
// Path: src/main/java/org/fest/util/ToString.java
// public static @Nullable String toStringOf(@Nullable Object o) {
//   if (isArray(o)) {
//     return Arrays.format(o);
//   }
//   if (o instanceof Calendar) {
//     return toStringOf(o);
//   }
//   if (o instanceof Class<?>) {
//     return toStringOf((Class<?>) o);
//   }
//   if (o instanceof Collection<?>) {
//     return toStringOf((Collection<?>) o);
//   }
//   if (o instanceof Date) {
//     return toStringOf(o);
//   }
//   if (o instanceof Float) {
//     return toStringOf((Float) o);
//   }
//   if (o instanceof Long) {
//     return toStringOf((Long) o);
//   }
//   if (o instanceof File) {
//     return toStringOf((File) o);
//   }
//   if (o instanceof Map<?, ?>) {
//     return toStringOf((Map<?, ?>) o);
//   }
//   if (o instanceof String) {
//     return quote((String) o);
//   }
//   if (o instanceof Comparator) {
//     return toStringOf((Comparator<?>) o);
//   }
//   return o == null ? null : o.toString();
// }


// Path: src/main/java/org/fest/util/ArrayFormatter.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Array;
import java.util.HashSet;
import java.util.Set;
import static java.lang.reflect.Array.getLength;
import static org.fest.util.Arrays.isArray;
import static org.fest.util.Sets.newHashSet;
import static org.fest.util.ToString.toStringOf;

/*
 * Created on Mar 29, 2009
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 * 
 * Copyright @2009-2013 the original author or authors.
 */
package org.fest.util;




/**
 * Creates a {@code String} representation of an array.
 *
 * @author Alex Ruiz
 * @author Joel Costigliola
 */
final class ArrayFormatter {
  private static final String NULL = "null";

  @Nullable String format(@Nullable Object o) {
    if (o == null || !isArray(o)) {