Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoriiioffe committed Mar 8, 2023
1 parent 0560bca commit feacd12
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/src/main/java/com/keylesspalace/tusky/util/NumberUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package com.keylesspalace.tusky.util

import java.text.DecimalFormat


fun shortNumber(number: Number) : String {
fun shortNumber(number: Number): String {
val array = arrayOf(' ', 'k', 'M', 'B', 'T', 'P', 'E')
val value = Math.floor(Math.log10(number.toDouble())).toInt()
val base = value / 3
val base = value / 3
if (value >= 3 && base < array.size) {
return DecimalFormat("#0.0").format(number.toDouble() / Math.pow(10.0, (base * 3).toDouble())) + array[base]
} else {
Expand Down

0 comments on commit feacd12

Please sign in to comment.