Sample

JetBrains/e2

Human rating uses the original dataset scale.

DatasetJetBrains
Human0.44
Lines19

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.0020–1; higher is more readable
73.7Δ 62.3
Scalabrino0.6760–1; higher is more readable
53.4Δ 41.9
Dorn0.8130–1; higher is more readable
98.3Δ 86.9
Mi0.6480–1; higher is more readable
85.6Δ 74.2
LLOC13Logical lines; fewer is more readable
52.1Δ 40.7
DeepSeek V4 Pro160–20; mean of three runs
53.4Δ 41.9
GPT-6.1 Sol160–20; mean of three runs
26.7Δ 15.3
BTTF0.3610–1; higher is more readable
21.2Δ 9.7
Human0.440–1; original rating
11.4

Views

Source code

public class HappyNumbers { public static void main(String[] args) { for(int i = 1; i <= 1000; i++) { int num = i; while(num != 1 && num != 4) { int sum = 0; while(num > 0) { int digit = num % 10; sum += digit * digit; num /= 10; } num = sum; } if(num == 1) { System.out.println(i); } } } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.548.053−18.086
Source linesThe number of non-empty source lines.19+7.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.3.236−4.853

Intercept 8.87 + feature contributions = -6.469 (log-odds).
Score = sigmoid(-6.469) = 0.002.

Score0.676

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.46.947+1.677
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.1+1.001
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.119−0.216
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.17.75−0.162
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.19−0.015

Intercept 0.07 + feature contributions = 1.471 (log-odds).
Score = sigmoid(1.471) = 0.813.

Score0.648
Score13
Run 1

The code is relatively short and straightforward, with a clear albeit implicit purpose. Structure is fine, but nested loops reduce readability. Meaning of '4' is ambiguous without context, hence it could be unclear to readers why it's used. Overall, it's readable but could benefit from helper methods, documentation, and clearer termination logic.

Run 2

The code is logically organized and reasonably readable. The outer loop iterates through numbers, and the inner loops handle digit extraction and sum calculation without excessive nesting. Variable names like 'num', 'sum', and 'digit' are clear in context. However, the use of '4' as a magic number to detect non-happy numbers hurts clarity; a named constant or comment would improve intent. The code is concise and each line generally performs one action. Reading flow is natural, following the happy number algorithm. Minor improvements like adding a helper method for summing squared digits and explaining the '4' condition would elevate readability.

Run 3

The code is reasonably structured with a clear separation of the main loop, the happy-number cycle check, and the digit-square summation. It avoids deep nesting (max 3 levels), keeps lines mostly simple, and maintains an understandable flow: iterate numbers, process each until 1 or 4, print if happy. However, the intent is not immediately obvious due to the hardcoded '4' stopping condition and the lack of comments or helper methods. The logic for detecting a non-happy cycle is implicit, which reduces clarity. Action granularity is mostly good, though the while condition `num != 1 && num != 4` packs two checks. Overall, it’s compact but could benefit from a method like `isHappy(int)` and a brief comment explaining the cycle detection.

Run 1

Code Structure: Logically organized around checking and printing happy numbers, though extracting the check into a helper method would improve separation. Nesting: Several nested loops increase reading effort, but the short bodies remain manageable. Clarity of intent: The class name and digit-square calculation convey the purpose; the unexplained termination value 4 and upper bound 1000 reduce clarity. Code length: Concise without unnecessary statements. Action granularity: Each statement performs one clear action. Reading flow: Initialization, digit processing, termination, and output follow a natural sequence, although inconsistent indentation and spacing slightly hinder scanning.

Run 2

Code Structure: Logically organized around checking and printing happy numbers, although extracting the check into a helper method would improve separation. Nesting: Four control-flow levels at the deepest point make the digit-processing loop moderately nested. Clarity of intent: The class name and variables convey the purpose, but the unexplained termination value 4 requires knowledge of unhappy-number cycles. Code length: Concise, with no unnecessary statements. Action granularity: Each statement performs one clear action. Reading flow: The sequence from candidate selection to digit-square summation to output is natural, though inconsistent indentation and tight spacing slightly reduce readability.

Run 3

Code Structure: Logically organized around checking each number and printing happy numbers, though extracting the check into a method would improve separation. Nesting: Three nested loops create moderate depth, but the blocks remain easy to follow. Clarity of intent: The class name and digit-squaring operations convey the purpose; the unexplained stopping value 4 and upper bound 1000 reduce clarity. Code length: Compact without unnecessary statements. Action granularity: Each statement performs one clear action. Reading flow: The sequence from candidate selection through digit processing to output is natural, although inconsistent indentation and sparse spacing slightly hinder readability.