Here you can find the source of convert(Long[] targets)
public static String[] convert(Long[] targets)
//package com.java2s; /*//from ww w. ja va 2 s. com * Copyright 2012 Kazumune Katagiri. (http://d.hatena.ne.jp/nemuzuka) * * 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. */ import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class Main { public static Long[] convert(String[] targets) { if (targets == null) { return new Long[0]; } List<Long> list = new ArrayList<Long>(); for (String target : targets) { list.add(Long.valueOf(target)); } return list.toArray(new Long[0]); } public static String[] convert(Long[] targets) { if (targets == null) { return new String[0]; } List<String> list = new ArrayList<String>(); for (Long target : targets) { list.add(target.toString()); } return list.toArray(new String[0]); } public static String toString(Integer val) { if (val == null) { return ""; } return String.valueOf(val); } public static String toString(Date date, SimpleDateFormat sdf) { if (date == null) { return ""; } return sdf.format(date); } public static String toString(Long val) { if (val == null) { return ""; } return String.valueOf(val); } public static String toString(Number val, DecimalFormat df) { if (val == null) { return ""; } return df.format(val); } }