Example usage for java.lang Long toHexString

List of usage examples for java.lang Long toHexString

Introduction

In this page you can find the example usage for java.lang Long toHexString.

Prototype

public static String toHexString(long i) 

Source Link

Document

Returns a string representation of the long argument as an unsigned integer in base 16.

Usage

From source file:com.apabi.r2k.common.security.util.NonceUtils.java

/**
 * ??1970, Hex?.
 */
public static String currentHexMills() {
    return Long.toHexString(currentMills());
}

From source file:org.segrada.search.SearchHit.java

public String getColorCode() {
    return (color == null) ? "" : "#" + StringUtils.leftPad(Long.toHexString(color).toUpperCase(), 6, "0");
}

From source file:com.pursuer.reader.easyrss.data.parser.ItemIdJSONParser.java

public void parse() throws JsonParseException, IOException {
    ItemId itemId = new ItemId();
    int level = 0;
    while (parser.nextToken() != null) {
        final String name = parser.getCurrentName();
        switch (parser.getCurrentToken()) {
        case START_OBJECT:
        case START_ARRAY:
            level++;/*  ww  w.j  av a  2  s  . co m*/
            break;
        case END_OBJECT:
        case END_ARRAY:
            level--;
            break;
        case VALUE_STRING:
            if (level == 3) {
                if ("id".equals(name)) {
                    itemId.setUid(Long.toHexString(Long.valueOf(parser.getText())));
                } else if ("timestampUsec".equals(name)) {
                    itemId.setTimestamp(Long.valueOf(parser.getText()));
                }
            }
            break;
        default:
            break;
        }
        if (level == 2) {
            if (itemId.getUid() != null && listener != null) {
                listener.onItemIdRetrieved(itemId);
            }
            itemId = new ItemId();
        }
    }
    parser.close();
}

From source file:Uid.java

/**
 * @see java.lang.Object#toString()//www  .  j a  v a 2 s  .c  o  m
 */
public String toString() {
    String timeString = Long.toHexString(time);
    String countString = Integer.toHexString(count);

    return machineIdString + "_" + timeString + "_" + countString;
}

From source file:com.javaid.bolaky.domain.userregistration.service.impl.DefaultUserRegistrationServiceIntegrationTest.java

@Test
public void saveAndRetrievePerson() {

    String username = Long.toHexString(RandomUtils.nextLong());

    Person person = createPerson(username, "password", "javaid", "javaid", 2, AgeGroup.THIRTY_ONE_TO_THIRTYFIVE,
            true, false, true, false, Gender.MALE, true, "javaid.bolaky@tnt.com", "2307768487");

    Address address = new Address("ADDRESS_LINE_1", "MRU", "23000", "PL", "PL");
    person.getContactDetails().addAddress(address);
    Address address2 = new Address("ADDRESS_LINE_3", "MU", "23000", "BB", "BB");
    person.getContactDetails().addAddress(address2);

    person = userRegistrationService.savePerson(person);
    assertThat(person.getCreationUsername(), is("Javaid"));
    assertThat(username, is(notNullValue()));

    Person person2 = userRegistrationService.retrievePerson(username);
    assertPerson(person2, username, "password", "javaid", "javaid", 2, AgeGroup.THIRTY_ONE_TO_THIRTYFIVE, true,
            false, true, false, Gender.MALE, true, "javaid.bolaky@tnt.com", "2307768487");

    Iterator<Address> iterator = person2.getContactDetails().getAddresses().iterator();

    assertAddress(iterator.next(), "ADDRESS_LINE_1", "MRU", "23000", "PL", "PL");

    assertAddress(iterator.next(), "ADDRESS_LINE_3", "MU", "23000", "BB", "BB");
}

From source file:com.rapid7.diskstorage.dynamodb.DynamoDBStoreTransaction.java

public DynamoDBStoreTransaction(BaseTransactionConfig config) {
    super(config);
    id = Constants.HEX_PREFIX + Long.toHexString(System.currentTimeMillis());
    LOG.debug("begin id:{} config:{}", id, config);
}

From source file:com.amazon.janusgraph.diskstorage.dynamodb.DynamoDBStoreTransaction.java

public DynamoDBStoreTransaction(BaseTransactionConfig config) {
    super(config);
    id = Constants.HEX_PREFIX + Long.toHexString(System.nanoTime());
    LOG.debug("begin id:{} config:{}", id, config);
}

From source file:org.microg.gms.checkin.CheckinService.java

@SuppressWarnings("MissingPermission")
@Override//  w ww  .  j  a v  a  2  s . c o m
protected void onHandleIntent(Intent intent) {
    try {
        if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PREF_ENABLE_CHECKIN, false)) {
            LastCheckinInfo info = CheckinManager.checkin(this,
                    intent.getBooleanExtra(EXTRA_FORCE_CHECKIN, false));
            if (info != null) {
                Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));
                String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
                for (Account account : AccountManager.get(this).getAccountsByType(accountType)) {
                    PeopleManager.loadUserInfo(this, account);
                }
                McsService.scheduleReconnect(this);
                if (intent.hasExtra(EXTRA_CALLBACK_INTENT)) {
                    startService((Intent) intent.getParcelableExtra(EXTRA_CALLBACK_INTENT));
                }
            }
        }
    } catch (Exception e) {
        Log.w(TAG, e);
    } finally {
        WakefulBroadcastReceiver.completeWakefulIntent(intent);
        stopSelf();
    }
}

From source file:org.moe.natjgen.CEnumConstant.java

@Override
public String toString() {
    StringBuilder b = new StringBuilder();
    b.append("<constant name=\"");
    b.append(StringEscapeUtils.escapeXml(getName()));
    b.append("\"");

    b.append(" value=\"");
    b.append(Long.toHexString(value.getValue()));
    b.append("\"");

    if (value.hasDifferent32BitValue()) {
        b.append(" value32=\"");
        b.append(Long.toHexString(value.getValue32()));
        b.append("\"");
    }//from w w w  .j a v  a 2s .  c  o  m

    b.append(" />");

    return b.toString();
}

From source file:cn.vlabs.umt.services.ticket.impl.TicketServiceImpl.java

public String generateKeys(String extra, String sessionid, String userip, int type) {
    String random = util.getRandom(randlength);

    InternalTicket ticket = new InternalTicket();
    ticket.setCreateTime(new Date());
    ticket.setExtra(extra);/*from ww  w  .jav a 2  s. c o  m*/
    ticket.setSessionid(sessionid);
    ticket.setType(type);
    ticket.setUserIp(userip);
    ticket.setRandom(random);

    long id = td.save(ticket);
    String idpart = Long.toHexString(id);
    return idpart + "|" + random;
}