Tabnine Logo
Long.toString
Code IndexAdd Tabnine to your IDE (free)

How to use
toString
method
in
java.lang.Long

Best Java code snippets using java.lang.Long.toString (Showing top 20 results out of 56,844)

origin: google/guava

@Override
protected String doBackward(Long value) {
 return value.toString();
}
origin: iluwatar/java-design-patterns

@Override
public void onPostCall(Long result) {
 // Handle the result of computation
 LOGGER.info(result.toString());
}
origin: spring-projects/spring-framework

/**
 * Set the (new) value of the {@code Access-Control-Max-Age} response header.
 */
public void setAccessControlMaxAge(long maxAge) {
  set(ACCESS_CONTROL_MAX_AGE, Long.toString(maxAge));
}
origin: spring-projects/spring-framework

/**
 * Set the length of the body in bytes, as specified by the
 * {@code Content-Length} header.
 */
public void setContentLength(long contentLength) {
  set(CONTENT_LENGTH, Long.toString(contentLength));
}
origin: google/guava

/**
 * Returns the String representation of the {@link #sum}.
 *
 * @return the String representation of the {@link #sum}
 */
public String toString() {
 return Long.toString(sum());
}
origin: google/guava

/**
 * Returns the String representation of the {@link #sum}.
 *
 * @return the String representation of the {@link #sum}
 */
public String toString() {
 return Long.toString(sum());
}
origin: spring-projects/spring-framework

public void arrayj(long... vargs) {
  s = "";
  if (vargs != null) {
    s = "";
    for (long v: vargs) {
      this.s += Long.toString(v);
    }
  }
}
origin: spring-projects/spring-framework

/**
 * Set the content-length header.
 * Applies to the SEND, MESSAGE, and ERROR frames.
 */
public void setContentLength(long contentLength) {
  set(CONTENT_LENGTH, Long.toString(contentLength));
}
origin: spring-projects/spring-framework

@Override
public String nextStringValue() throws DataAccessException {
  String s = Long.toString(getNextKey());
  int len = s.length();
  if (len < this.paddingLength) {
    StringBuilder sb = new StringBuilder(this.paddingLength);
    for (int i = 0; i < this.paddingLength - len; i++) {
      sb.append('0');
    }
    sb.append(s);
    s = sb.toString();
  }
  return s;
}
origin: square/okhttp

private static Headers withSyntheticHeaders(Response okResponse) {
 return okResponse.headers().newBuilder()
   .add(SENT_MILLIS, Long.toString(okResponse.sentRequestAtMillis()))
   .add(RECEIVED_MILLIS, Long.toString(okResponse.receivedResponseAtMillis()))
   .build();
}
origin: square/okhttp

/**
 * Now that we've buffered the entire request body, update the request headers and the body
 * itself. This happens late to enable HttpURLConnection users to complete the socket connection
 * before sending request body bytes.
 */
@Override public Request prepareToSendRequest(Request request) throws IOException {
 if (request.header("Content-Length") != null) return request;
 outputStream().close();
 contentLength = buffer.size();
 return request.newBuilder()
   .removeHeader("Transfer-Encoding")
   .header("Content-Length", Long.toString(buffer.size()))
   .build();
}
origin: google/guava

public void testParseInt() {
 for (long a : UNSIGNED_INTS) {
  assertEquals((int) a, UnsignedInts.parseUnsignedInt(Long.toString(a)));
 }
}
origin: google/guava

public void testParseIntWithRadix() {
 for (long a : UNSIGNED_INTS) {
  for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; radix++) {
   assertEquals((int) a, UnsignedInts.parseUnsignedInt(Long.toString(a, radix), radix));
  }
 }
}
origin: google/guava

public void testParseIntFail() {
 try {
  UnsignedInts.parseUnsignedInt(Long.toString(1L << 32));
  fail("Expected NumberFormatException");
 } catch (NumberFormatException expected) {
 }
}
origin: google/guava

public void testToString() {
 int[] bases = {2, 5, 7, 8, 10, 16};
 for (long a : UNSIGNED_INTS) {
  for (int base : bases) {
   assertEquals(UnsignedInts.toString((int) a, base), Long.toString(a, base));
  }
 }
}
origin: spring-projects/spring-framework

@Test
public void defaultModules() throws JsonProcessingException, UnsupportedEncodingException {
  this.factory.afterPropertiesSet();
  ObjectMapper objectMapper = this.factory.getObject();
  Long timestamp = 1322903730000L;
  DateTime dateTime = new DateTime(timestamp, DateTimeZone.UTC);
  assertEquals(timestamp.toString(), new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8"));
}
origin: spring-projects/spring-framework

@Test
public void wellKnownModules() throws JsonProcessingException, UnsupportedEncodingException {
  ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().build();
  Long timestamp = 1322903730000L;
  DateTime dateTime = new DateTime(timestamp, DateTimeZone.UTC);
  assertEquals(timestamp.toString(), new String(objectMapper.writeValueAsBytes(dateTime), "UTF-8"));
  Path file = Paths.get("foo");
  assertTrue(new String(objectMapper.writeValueAsBytes(file), "UTF-8").endsWith("foo\""));
  Optional<String> optional = Optional.of("test");
  assertEquals("\"test\"", new String(objectMapper.writeValueAsBytes(optional), "UTF-8"));
  // Kotlin module
  IntRange range = new IntRange(1, 3);
  assertEquals("{\"start\":1,\"end\":3}", new String(objectMapper.writeValueAsBytes(range), "UTF-8"));
}
origin: spring-projects/spring-framework

@GetMapping("/event")
Flux<ServerSentEvent<Person>> sse() {
  return INTERVAL.take(2).map(l ->
      ServerSentEvent.builder(new Person("foo " + l))
          .id(Long.toString(l))
          .comment("bar " + l)
          .build());
}
origin: google/guava

@GwtIncompatible // too slow
public void testEquals() {
 EqualsTester equalsTester = new EqualsTester();
 for (int a : TEST_INTS) {
  long value = a & 0xffffffffL;
  equalsTester.addEqualityGroup(
    UnsignedInteger.fromIntBits(a),
    UnsignedInteger.valueOf(value),
    UnsignedInteger.valueOf(Long.toString(value)),
    UnsignedInteger.valueOf(Long.toString(value, 16), 16));
 }
 equalsTester.testEquals();
}
origin: google/guava

public void testTryParse_radix() {
 for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; radix++) {
  radixEncodeParseAndAssertEquals(0, radix);
  radixEncodeParseAndAssertEquals(8000, radix);
  radixEncodeParseAndAssertEquals(-8000, radix);
  radixEncodeParseAndAssertEquals(GREATEST, radix);
  radixEncodeParseAndAssertEquals(LEAST, radix);
  assertNull("Radix: " + radix, Ints.tryParse("9999999999999999", radix));
  assertNull(
    "Radix: " + radix, Ints.tryParse(Long.toString((long) GREATEST + 1, radix), radix));
  assertNull("Radix: " + radix, Ints.tryParse(Long.toString((long) LEAST - 1, radix), radix));
 }
 assertNull("Hex string and dec parm", Ints.tryParse("FFFF", 10));
 assertEquals("Mixed hex case", 65535, (int) Ints.tryParse("ffFF", 16));
}
java.langLongtoString

Javadoc

Returns a String object representing this Long's value. The value is converted to signed decimal representation and returned as a string, exactly as if the long value were given as an argument to the java.lang.Long#toString(long) method.

Popular methods of Long

  • parseLong
    Parses the string argument as a signed long in the radix specified by the second argument. The chara
  • valueOf
    Returns a Long object holding the value extracted from the specified String when parsed with the rad
  • longValue
    Returns the value of this Long as a long value.
  • <init>
    Constructs a newly allocated Long object that represents the long value indicated by the String para
  • intValue
    Returns the value of this Long as an int.
  • equals
    Compares this object to the specified object. The result is true if and only if the argument is not
  • hashCode
  • toHexString
    Returns a string representation of the longargument as an unsigned integer in base 16.The unsigned l
  • compareTo
    Compares this Long object to another object. If the object is a Long, this function behaves likecomp
  • compare
    Compares two long values numerically. The value returned is identical to what would be returned by:
  • doubleValue
    Returns the value of this Long as a double.
  • decode
    Decodes a String into a Long. Accepts decimal, hexadecimal, and octal numbers given by the following
  • doubleValue,
  • decode,
  • numberOfLeadingZeros,
  • numberOfTrailingZeros,
  • bitCount,
  • signum,
  • reverseBytes,
  • toBinaryString,
  • shortValue

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • String (java.lang)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now