<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:48:00 PST 2010 -->
<TITLE>
Longs (Guava Libraries 2010.01.04)
</TITLE>
<META NAME="date" CONTENT="2010-01-04">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Longs (Guava Libraries 2010.01.04)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Longs.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/google/common/primitives/Ints.html" title="class in com.google.common.primitives"><B>PREV CLASS</B></A>
<A HREF="../../../../com/google/common/primitives/Primitives.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/google/common/primitives/Longs.html" target="_top"><B>FRAMES</B></A>
<A HREF="Longs.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.google.common.primitives</FONT>
<BR>
Class Longs</H2>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.primitives.Longs</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>Longs</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>
<P>
Static utility methods pertaining to <code>long</code> primitives, that are not
already found in either <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang"><CODE>Long</CODE></A> or <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true" title="class or interface in java.util"><CODE>Arrays</CODE></A>.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>2009.09.15 <b>tentative</b></DD>
<DT><B>Author:</B></DT>
<DD>Kevin Bourrillion</DD>
</DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#BYTES">BYTES</A></B></CODE>
<BR>
The number of bytes required to represent a primitive <code>long</code>
value.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang">Long</A>></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#asList(long...)">asList</A></B>(long... backingArray)</CODE>
<BR>
Returns a fixed-size list backed by the specified array, similar to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#compare(long, long)">compare</A></B>(long a,
long b)</CODE>
<BR>
Compares the two specified <code>long</code> values.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#concat(long[]...)">concat</A></B>(long[]... arrays)</CODE>
<BR>
Returns the values from each provided array combined into a single array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#contains(long[], long)">contains</A></B>(long[] array,
long target)</CODE>
<BR>
Returns <code>true</code> if <code>target</code> is present as an element anywhere in
<code>array</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#ensureCapacity(long[], int, int)">ensureCapacity</A></B>(long[] array,
int minLength,
int padding)</CODE>
<BR>
Returns an array containing the same values as <code>array</code>, but
guaranteed to be of a specified minimum length.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#fromByteArray(byte[])">fromByteArray</A></B>(byte[] bytes)</CODE>
<BR>
Returns the <code>long</code> value whose big-endian representation is
stored in the first 8 bytes of <code>bytes</code>; equivalent to <code>ByteBuffer.wrap(bytes).getLong()</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#hashCode(long)">hashCode</A></B>(long value)</CODE>
<BR>
Returns a hash code for <code>value</code>; equal to the result of invoking
<code>((Long) value).hashCode()</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#indexOf(long[], long)">indexOf</A></B>(long[] array,
long target)</CODE>
<BR>
Returns the index of the first appearance of the value <code>target</code> in
<code>array</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#indexOf(long[], long[])">indexOf</A></B>(long[] array,
long[] target)</CODE>
<BR>
Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#join(java.lang.String, long...)">join</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> separator,
long... array)</CODE>
<BR>
Returns a string containing the supplied <code>long</code> values separated
by <code>separator</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#lastIndexOf(long[], long)">lastIndexOf</A></B>(long[] array,
long target)</CODE>
<BR>
Returns the index of the last appearance of the value <code>target</code> in
<code>array</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><long[]></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#lexicographicalComparator()">lexicographicalComparator</A></B>()</CODE>
<BR>
Returns a comparator that compares two <code>long</code> arrays
lexicographically.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#max(long...)">max</A></B>(long... array)</CODE>
<BR>
Returns the greatest value present in <code>array</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#min(long...)">min</A></B>(long... array)</CODE>
<BR>
Returns the least value present in <code>array</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#toArray(java.util.Collection)">toArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang">Long</A>> collection)</CODE>
<BR>
Copies a collection of <code>Long</code> instances into a new array of
primitive <code>long</code> values.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Longs.html#toByteArray(long)">toByteArray</A></B>(long value)</CODE>
<BR>
Returns a big-endian representation of <code>value</code> in an 8-element byte
array; equivalent to <code>ByteBuffer.allocate(8).putLong(value).array()</code>.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="BYTES"><!-- --></A><H3>
BYTES</H3>
<PRE>
public static final int <B>BYTES</B></PRE>
<DL>
<DD>The number of bytes required to represent a primitive <code>long</code>
value.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.google.common.primitives.Longs.BYTES">Constant Field Values</A></DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="hashCode(long)"><!-- --></A><H3>
hashCode</H3>
<PRE>
public static int <B>hashCode</B>(long value)</PRE>
<DL>
<DD>Returns a hash code for <code>value</code>; equal to the result of invoking
<code>((Long) value).hashCode()</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>value</CODE> - a primitive <code>long</code> value
<DT><B>Returns:</B><DD>a hash code for the value</DL>
</DD>
</DL>
<HR>
<A NAME="compare(long, long)"><!-- --></A><H3>
compare</H3>
<PRE>
public static int <B>compare</B>(long a,
long b)</PRE>
<DL>
<DD>Compares the two specified <code>long</code> values. The sign of the value
returned is the same as that of <code>((Long) a).compareTo(b)</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - the first <code>long</code> to compare<DD><CODE>b</CODE> - the second <code>long</code> to compare
<DT><B>Returns:</B><DD>a negative value if <code>a</code> is less than <code>b</code>; a positive
value if <code>a</code> is greater than <code>b</code>; or zero if they are equal</DL>
</DD>
</DL>
<HR>
<A NAME="contains(long[], long)"><!-- --></A><H3>
contains</H3>
<PRE>
public static boolean <B>contains</B>(long[] array,
long target)</PRE>
<DL>
<DD>Returns <code>true</code> if <code>target</code> is present as an element anywhere in
<code>array</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>long</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>long</code> value
<DT><B>Returns:</B><DD><code>true</code> if <code>array[i] == target</code> for some value of <code>i</code></DL>
</DD>
</DL>
<HR>
<A NAME="indexOf(long[], long)"><!-- --></A><H3>
indexOf</H3>
<PRE>
public static int <B>indexOf</B>(long[] array,
long target)</PRE>
<DL>
<DD>Returns the index of the first appearance of the value <code>target</code> in
<code>array</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>long</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>long</code> value
<DT><B>Returns:</B><DD>the least index <code>i</code> for which <code>array[i] == target</code>, or
<code>-1</code> if no such index exists.</DL>
</DD>
</DL>
<HR>
<A NAME="indexOf(long[], long[])"><!-- --></A><H3>
indexOf</H3>
<PRE>
public static int <B>indexOf</B>(long[] array,
long[] target)</PRE>
<DL>
<DD>Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.
<p>More formally, returns the lowest index <code>i</code> such that <code>java.util.Arrays.copyOfRange(array, i, i + target.length)</code> contains exactly
the same elements as <code>target</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to search for the sequence <code>target</code><DD><CODE>target</CODE> - the array to search for as a sub-sequence of <code>array</code></DL>
</DD>
</DL>
<HR>
<A NAME="lastIndexOf(long[], long)"><!-- --></A><H3>
lastIndexOf</H3>
<PRE>
public static int <B>lastIndexOf</B>(long[] array,
long target)</PRE>
<DL>
<DD>Returns the index of the last appearance of the value <code>target</code> in
<code>array</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>long</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>long</code> value
<DT><B>Returns:</B><DD>the greatest index <code>i</code> for which <code>array[i] == target</code>,
or <code>-1</code> if no such index exists.</DL>
</DD>
</DL>
<HR>
<A NAME="min(long...)"><!-- --></A><H3>
min</H3>
<PRE>
public static long <B>min</B>(long... array)</PRE>
<DL>
<DD>Returns the least value present in <code>array</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - a <i>nonempty</i> array of <code>long</code> values
<DT><B>Returns:</B><DD>the value present in <code>array</code> that is less than or equal to
every other value in the array
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>array</code> is empty</DL>
</DD>
</DL>
<HR>
<A NAME="max(long...)"><!-- --></A><H3>
max</H3>
<PRE>
public static long <B>max</B>(long... array)</PRE>
<DL>
<DD>Returns the greatest value present in <code>array</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - a <i>nonempty</i> array of <code>long</code> values
<DT><B>Returns:</B><DD>the value present in <code>array</code> that is greater than or equal to
every other value in the array
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>array</code> is empty</DL>
</DD>
</DL>
<HR>
<A NAME="concat(long[]...)"><!-- --></A><H3>
concat</H3>
<PRE>
public static long[] <B>concat</B>(long[]... arrays)</PRE>
<DL>
<DD>Returns the values from each provided array combined into a single array.
For example, <code>concat(new long[] {a, b}, new long[] {}, new
long[] {c}</code> returns the array <code>{a, b, c}</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>arrays</CODE> - zero or more <code>long</code> arrays
<DT><B>Returns:</B><DD>a single array containing all the values from the source arrays, in
order</DL>
</DD>
</DL>
<HR>
<A NAME="toByteArray(long)"><!-- --></A><H3>
toByteArray</H3>
<PRE>
public static byte[] <B>toByteArray</B>(long value)</PRE>
<DL>
<DD>Returns a big-endian representation of <code>value</code> in an 8-element byte
array; equivalent to <code>ByteBuffer.allocate(8).putLong(value).array()</code>.
For example, the input value <code>0x1213141516171819L</code> would yield the
byte array <code>{0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}</code>.
<p>If you need to convert and concatenate several values (possibly even of
different types), use a shared <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio"><CODE>ByteBuffer</CODE></A> instance, or use
<A HREF="../../../../com/google/common/io/ByteStreams.html#newDataOutput()"><CODE>ByteStreams.newDataOutput()</CODE></A> to get a growable
buffer.
<p><b>Warning:</b> do not use this method in GWT. It returns wrong answers.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="fromByteArray(byte[])"><!-- --></A><H3>
fromByteArray</H3>
<PRE>
public static long <B>fromByteArray</B>(byte[] bytes)</PRE>
<DL>
<DD>Returns the <code>long</code> value whose big-endian representation is
stored in the first 8 bytes of <code>bytes</code>; equivalent to <code>ByteBuffer.wrap(bytes).getLong()</code>. For example, the input byte array
<code>{0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}</code> would yield the
<code>long</code> value <code>0x1213141516171819L</code>.
<p>Arguably, it's preferable to use <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio"><CODE>ByteBuffer</CODE></A>; that
library exposes much more flexibility at little cost in readability.
<p><b>Warning:</b> do not use this method in GWT. It returns wrong answers.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>bytes</code> has fewer than 8
elements</DL>
</DD>
</DL>
<HR>
<A NAME="ensureCapacity(long[], int, int)"><!-- --></A><H3>
ensureCapacity</H3>
<PRE>
public static long[] <B>ensureCapacity</B>(long[] array,
int minLength,
int padding)</PRE>
<DL>
<DD>Returns an array containing the same values as <code>array</code>, but
guaranteed to be of a specified minimum length. If <code>array</code> already
has a length of at least <code>minLength</code>, it is returned directly.
Otherwise, a new array of size <code>minLength + padding</code> is returned,
containing the values of <code>array</code>, and zeroes in the remaining places.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - the source array<DD><CODE>minLength</CODE> - the minimum length the returned array must guarantee<DD><CODE>padding</CODE> - an extra amount to "grow" the array by if growth is
necessary
<DT><B>Returns:</B><DD>an array containing the values of <code>array</code>, with guaranteed
minimum length <code>minLength</code>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>minLength</code> or <code>padding</code> is
negative</DL>
</DD>
</DL>
<HR>
<A NAME="join(java.lang.String, long...)"><!-- --></A><H3>
join</H3>
<PRE>
public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>join</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> separator,
long... array)</PRE>
<DL>
<DD>Returns a string containing the supplied <code>long</code> values separated
by <code>separator</code>. For example, <code>join("-", 1L, 2L, 3L)</code> returns
the string <code>"1-2-3"</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>separator</CODE> - the text that should appear between consecutive values in
the resulting string (but not at the start or end)<DD><CODE>array</CODE> - an array of <code>long</code> values, possibly empty</DL>
</DD>
</DL>
<HR>
<A NAME="lexicographicalComparator()"><!-- --></A><H3>
lexicographicalComparator</H3>
<PRE>
public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><long[]> <B>lexicographicalComparator</B>()</PRE>
<DL>
<DD>Returns a comparator that compares two <code>long</code> arrays
lexicographically. That is, it compares, using <A HREF="../../../../com/google/common/primitives/Longs.html#compare(long, long)"><CODE>compare(long, long)</CODE></A>), the first pair of values that follow any
common prefix, or when one array is a prefix of the other, treats the
shorter array as the lesser. For example,
<code>[] < [1L] < [1L, 2L] < [2L]</code>.
<p>The returned comparator is inconsistent with <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang"><CODE>Object.equals(Object)</CODE></A> (since arrays support only identity equality), but
it is consistent with <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#equals(long[], long[])" title="class or interface in java.util"><CODE>Arrays.equals(long[], long[])</CODE></A>.
<P>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>2010.01.04 <b>tentative</b></DD>
<DT><B>See Also:</B><DD><a href="http://en.wikipedia.org/wiki/Lexicographical_order">
Lexicographical order</a> article at Wikipedia</DL>
</DD>
</DL>
<HR>
<A NAME="toArray(java.util.Collection)"><!-- --></A><H3>
toArray</H3>
<PRE>
public static long[] <B>toArray</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang">Long</A>> collection)</PRE>
<DL>
<DD>Copies a collection of <code>Long</code> instances into a new array of
primitive <code>long</code> values.
<p>Elements are copied from the argument collection as if by <code>collection.toArray()</code>. Calling this method is as thread-safe as calling
that method.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>collection</CODE> - a collection of <code>Long</code> objects
<DT><B>Returns:</B><DD>an array containing the same values as <code>collection</code>, in the
same order, converted to primitives
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>collection</code> or any of its elements
is null</DL>
</DD>
</DL>
<HR>
<A NAME="asList(long...)"><!-- --></A><H3>
asList</H3>
<PRE>
public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang">Long</A>> <B>asList</B>(long... backingArray)</PRE>
<DL>
<DD>Returns a fixed-size list backed by the specified array, similar to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>. The list supports <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true#set(int, E)" title="class or interface in java.util"><CODE>List.set(int, Object)</CODE></A>,
but any attempt to set a value to <code>null</code> will result in a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang"><CODE>NullPointerException</CODE></A>.
<p>The returned list maintains the values, but not the identities, of
<code>Long</code> objects written to or read from it. For example, whether
<code>list.get(0) == list.get(0)</code> is true for the returned list is
unspecified.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>backingArray</CODE> - the array to back the list
<DT><B>Returns:</B><DD>a list view of the array</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Longs.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/google/common/primitives/Ints.html" title="class in com.google.common.primitives"><B>PREV CLASS</B></A>
<A HREF="../../../../com/google/common/primitives/Primitives.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/google/common/primitives/Longs.html" target="_top"><B>FRAMES</B></A>
<A HREF="Longs.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>