| 743 | } |
| 744 | |
| 745 | public static @NotNull BigDecimal toBigDecimal(long hh, long hl, long lh, long ll, int scale) { |
| 746 | // Convert 256-bit value to BigInteger |
| 747 | byte[] bytes = new byte[32]; // 256 bits = 32 bytes |
| 748 | // Fill bytes in big-endian order |
| 749 | putLongIntoBytes(bytes, 0, hh); |
| 750 | putLongIntoBytes(bytes, 8, hl); |
| 751 | putLongIntoBytes(bytes, 16, lh); |
| 752 | putLongIntoBytes(bytes, 24, ll); |
| 753 | |
| 754 | BigInteger unscaledValue = new BigInteger(bytes); |
| 755 | return new BigDecimal(unscaledValue, scale); |
| 756 | } |
| 757 | |
| 758 | /** |
| 759 | * Writes the string representation of the given Decimal256 to the specified CharSink. |