Java tutorial
//package com.java2s; /* * fb4j: Java API for Facebook * Copyright (C) 2007-2008 Biagio Miceli Jr, Cosimo Togna * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Full license may be found in LICENSE.txt or downloaded from * <http://www.gnu.org/licenses/>. fb4j documentation, updates and other * info can be found at <http://fb4j.sourceforge.net/> * * @version $Id$ */ import java.util.List; public class Main { @SuppressWarnings("unchecked") public static long[] toLongArray(List<? extends Number> list) { long[] array = new long[list.size()]; for (int i = 0; i < list.size(); i++) { array[i] = list.get(i).longValue(); } return array; } public static long[] toLongArray(String[] strings, char c) { long[] array = new long[strings.length]; for (int i = 0; i < strings.length; i++) { String string = strings[i].trim(); if (string.charAt(0) == c && string.charAt(string.length() - 1) == c) { string = string.substring(1, string.length() - 1); } array[i] = Long.parseLong(string); } return array; } }